hub v0.25.0: per-storage worst-fill alerting (StorageFillChecker)

Generalizes host_disk to any reported storage target (dump/backup volume, data drive,
thin pool, PBS). Per-(host,target) state, born/persistent, natural critical severity,
distinct storage_fill_* events; excludes the root-backed builtin (host_disk owns root).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxLA1mZurFq9kt8hneFeCs
This commit is contained in:
2026-06-30 19:01:20 +02:00
parent cac745ee04
commit 88073ac464
7 changed files with 445 additions and 0 deletions
+9
View File
@@ -51,6 +51,10 @@ type Config struct {
// (normalizeDiskThresholds). Seed-only config, like stale_threshold.
HostDiskWarnPercent float64 `yaml:"host_disk_warn_percent"`
HostDiskCritPercent float64 `yaml:"host_disk_crit_percent"`
// Per-storage-target fill thresholds (percent). Empty/0/invalid → defaults 90/95. Independent of
// the host-root thresholds above so a single storage's policy can be tuned separately.
StorageFillWarnPercent float64 `yaml:"storage_fill_warn_percent"`
StorageFillCritPercent float64 `yaml:"storage_fill_crit_percent"`
} `yaml:"alerting"`
Registry struct {
Image string `yaml:"image"`
@@ -330,6 +334,10 @@ func main() {
// root disk_percent the agent reports; born/persistent (a disk already full at hub restart alerts on
// cycle 1). Distinct event types from the controller's GUEST disk_warning/disk_critical. Same 60s sweep.
hostDiskChecker := monitor.NewHostDiskChecker(dataStore, cfg.Alerting.HostDiskWarnPercent, cfg.Alerting.HostDiskCritPercent, dispatcher.ProcessEvent, logger)
// v0.25.0: PER-STORAGE worst-fill alert — generalizes the host-root check to any reported storage
// target (dump/backup volume, data drive, lvmthin pool, PBS datastore). Born/persistent; excludes the
// root-backed builtin (hostDiskChecker owns root, no double-alert); emits natural `critical`. Same sweep.
storageFillChecker := monitor.NewStorageFillChecker(dataStore, cfg.Alerting.StorageFillWarnPercent, cfg.Alerting.StorageFillCritPercent, dispatcher.ProcessEvent, logger)
go func() {
ticker := time.NewTicker(60 * time.Second)
defer ticker.Stop()
@@ -343,6 +351,7 @@ func main() {
hostCapabilityChecker.Check()
hostLeafChecker.Check()
hostDiskChecker.Check()
storageFillChecker.Check()
}
}
}()