feat: PF States Chart (Sparkline letzte 8h) — Backend schreibt pf_states in TimescaleDB, Frontend zeigt SVG-Sparkline

This commit is contained in:
cynfo3000
2026-03-06 21:47:47 +01:00
parent e01fd7698c
commit aca013b848
2 changed files with 84 additions and 21 deletions
+8
View File
@@ -424,6 +424,14 @@ func (d *Database) writeMetrics(tx *sql.Tx, agentID string, ts time.Time, data *
}
}
// PF States
if data.PFStates != nil && data.PFStates.HardLimit > 0 {
stmt.Exec(ts, agentID, "pf_states_current", float64(data.PFStates.CurrentEntries), nil)
stmt.Exec(ts, agentID, "pf_states_limit", float64(data.PFStates.HardLimit), nil)
usedPct := float64(data.PFStates.CurrentEntries) / float64(data.PFStates.HardLimit) * 100
stmt.Exec(ts, agentID, "pf_states_used_percent", usedPct, nil)
}
// Gateways (Loss und Delay sind Strings wie "0.0%" und "1.2ms")
for _, gw := range data.Gateways {
if gw.Delay != "" {