Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Don't clear Ceph pool alerts in the stale-storage sweep

rcourtmanec7489498291
diff --git a/internal/alerts/alerts_test.go b/internal/alerts/alerts_test.go
index 107edabe64..a20f009b5a 100644
--- a/internal/alerts/alerts_test.go
+++ b/internal/alerts/alerts_test.go
@@ -17377,6 +17377,38 @@ func TestSyncStorageAlertsForInstance(t *testing.T) {
t.Fatal("expected alias-keyed ceph storage alert to be preserved")
}
})
+
+ t.Run("never clears ceph pool alerts absent from the storage inventory", func(t *testing.T) {
+ m := newTestManager(t)
+
+ m.mu.Lock()
+ // A ceph pool usage alert (raised by the separate Ceph poll path). Ceph
+ // pools are not part of the storage inventory passed to the sweep, so
+ // without the guard this would be cleared here and re-raised by the Ceph
+ // poll every cycle (flapping).
+ m.activeAlerts["pve1-ceph-pool-data-usage"] = &Alert{
+ ID: "pve1-ceph-pool-data-usage",
+ Type: "usage",
+ ResourceID: "pve1-ceph-pool-data",
+ Instance: "pve1",
+ Metadata: map[string]interface{}{
+ "resourceType": "storage",
+ },
+ }
+ m.mu.Unlock()
+
+ // Inventory has a different, unrelated storage; the ceph pool is absent.
+ m.SyncStorageAlertsForInstance("pve1", []models.Storage{
+ {ID: "pve1-node1-local", Name: "local", Instance: "pve1"},
+ })
+
+ m.mu.RLock()
+ defer m.mu.RUnlock()
+
+ if _, exists := m.activeAlerts["pve1-ceph-pool-data-usage"]; !exists {
+ t.Fatal("expected ceph pool alert to be preserved (managed by the ceph poll path, not this sweep)")
+ }
+ })
}
func TestDispatchAlert(t *testing.T) {
diff --git a/internal/alerts/storage.go b/internal/alerts/storage.go
index f00d525b29..99a2bade95 100644
--- a/internal/alerts/storage.go
+++ b/internal/alerts/storage.go
@@ -155,6 +155,13 @@ func (m *Manager) SyncStorageAlertsForInstance(instanceName string, storages []m
if !isStorageInventoryAlert(alert) {
continue
}
+ // Ceph pool storage alerts (id "<instance>-ceph-pool-<name>") are raised
+ // and cleared by the separate Ceph poll path, and Ceph pools are not in
+ // the `storages` inventory passed here. Never clear them, or they would
+ // flap (cleared every storage poll, re-raised every Ceph poll).
+ if strings.Contains(alert.ResourceID, "-ceph-pool-") {
+ continue
+ }
if _, exists := validResourceIDs[strings.TrimSpace(alert.ResourceID)]; exists {
continue
}