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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep shared Proxmox storage coherent
rcourtman523a64565b02
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 51ffc57c36..3e2385afd2 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -788,6 +788,13 @@ emit structured storage topology such as Unraid per-disk state, the sharedassessment layer must derive canonical risk and alert severity from thatricher disk topology instead of letting coarser aggregate counters override itand flap the operator-facing storage alert surface.+That same monitoring-owned storage polling boundary also owns cluster-shared+Proxmox storage status coherence. `internal/monitoring/monitor_polling_storage.go`+must merge shared storage observations across nodes into one cluster-scoped+record whose canonical status remains `available` whenever any reporting node+still has the shared target active; node-local inactive copies may expand node+affinity, but they must not downgrade the cluster record into an offline+projection just because that node won the capacity sample.That same monitoring-owned host-agent ingest boundary now also ownsvendor-managed NAS RAID normalization. `internal/monitoring/monitor_agents.go`must filter vendor-managed system arrays through the shareddiff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.goindex a170da145b..2f8b7ef034 100644--- a/internal/monitoring/canonical_guardrails_test.go+++ b/internal/monitoring/canonical_guardrails_test.go@@ -317,6 +317,27 @@ func TestStoragePollingUsesCanonicalPoolMetadataForZFSAttachment(t *testing.T) {}}+func TestStoragePollingKeepsSharedStorageClusterStatusCanonical(t *testing.T) {+ data, err := os.ReadFile("monitor_polling_storage.go")+ if err != nil {+ t.Fatalf("failed to read monitor_polling_storage.go: %v", err)+ }+ source := string(data)++ for _, snippet := range []string{+ "storage.Status = normalizeSharedStorageStatus(storage)",+ "entry.storage.Status = mergeSharedStorageStatus(entry.storage.Status, storage.Status)",+ "entry.storage.Enabled = entry.storage.Enabled || storage.Enabled",+ "entry.storage.Active = entry.storage.Active || storage.Active",+ "func normalizeSharedStorageStatus(storage models.Storage) string {",+ "func mergeSharedStorageStatus(current, candidate string) string {",+ } {+ if !strings.Contains(source, snippet) {+ t.Fatalf("monitor_polling_storage.go must contain %q", snippet)+ }+ }+}+func TestMonitoringTemperatureFallbackUsesSMARTAwareSSHSkipRule(t *testing.T) {requiredSnippets := map[string][]string{"host_agent_temps.go": {diff --git a/internal/monitoring/monitor_polling_storage.go b/internal/monitoring/monitor_polling_storage.goindex 7950be8617..219da082c2 100644--- a/internal/monitoring/monitor_polling_storage.go+++ b/internal/monitoring/monitor_polling_storage.go@@ -500,10 +500,14 @@ func (m *Monitor) pollStorageWithNodes(ctx context.Context, instanceName string,// reporting nodes but never merge across different Proxmox instances.key := storage.Instance + "/" + storage.NamenodeIdentifier := fmt.Sprintf("%s-%s", storage.Instance, storage.Node)+ storage.Status = normalizeSharedStorageStatus(storage)if entry, exists := sharedStorageMap[key]; exists {entry.nodes[storage.Node] = struct{}{}entry.nodeIDs[nodeIdentifier] = struct{}{}+ entry.storage.Status = mergeSharedStorageStatus(entry.storage.Status, storage.Status)+ entry.storage.Enabled = entry.storage.Enabled || storage.Enabled+ entry.storage.Active = entry.storage.Active || storage.Active// Prefer the entry with the most up-to-date utilization dataif storage.Used > entry.storage.Used || (storage.Total > entry.storage.Total && storage.Used == entry.storage.Used) {@@ -512,9 +516,6 @@ func (m *Monitor) pollStorageWithNodes(ctx context.Context, instanceName string,entry.storage.Free = storage.Freeentry.storage.Usage = storage.Usageentry.storage.ZFSPool = storage.ZFSPool- entry.storage.Status = storage.Status- entry.storage.Enabled = storage.Enabled- entry.storage.Active = storage.Activeentry.storage.Content = storage.Contententry.storage.Type = storage.Type}@@ -739,6 +740,54 @@ func (m *Monitor) fetchNodeStorageFallback(ctx context.Context, instanceCfg *conreturn directClient.GetStorage(ctx, nodeName)}+func normalizeSharedStorageStatus(storage models.Storage) string {+ status := strings.ToLower(strings.TrimSpace(storage.Status))+ switch status {+ case "online", "running", "available", "active", "ok":+ return "available"+ case "warning", "degraded":+ return "warning"+ case "offline", "down", "unavailable", "error":+ return "unavailable"+ case "disabled", "inactive":+ return status+ case "":+ if !storage.Enabled {+ return "disabled"+ }+ if storage.Active {+ return "available"+ }+ return "inactive"+ default:+ return status+ }+}++func mergeSharedStorageStatus(current, candidate string) string {+ if sharedStorageStatusRank(candidate) > sharedStorageStatusRank(current) {+ return candidate+ }+ return current+}++func sharedStorageStatusRank(status string) int {+ switch strings.ToLower(strings.TrimSpace(status)) {+ case "warning":+ return 5+ case "available":+ return 4+ case "unavailable":+ return 3+ case "inactive":+ return 2+ case "disabled":+ return 1+ default:+ return 0+ }+}+// pollPVENode polls a single PVE node and returns the resultfunc parseClusterStorageNodes(raw string) []string {raw = strings.TrimSpace(raw)diff --git a/internal/monitoring/monitor_storage_test.go b/internal/monitoring/monitor_storage_test.goindex 1fc9b5b6aa..1c74c996f8 100644--- a/internal/monitoring/monitor_storage_test.go+++ b/internal/monitoring/monitor_storage_test.go@@ -301,6 +301,95 @@ func TestPollStorageWithNodesSynthesizesSharedClusterOnlyStorage(t *testing.T) {}}+func TestPollStorageWithNodesKeepsSharedStorageAvailableWhenAnyNodeIsActive(t *testing.T) {+ monitor := &Monitor{+ state: models.NewState(),+ config: &config.Config{+ PVEInstances: []config.PVEInstance{+ {+ Name: "inst1",+ IsCluster: true,+ ClusterName: "cluster-a",+ },+ },+ },+ }++ client := &fakeStorageClient{+ allStorage: []proxmox.Storage{+ {+ Storage: "shared-nfs",+ Type: "nfs",+ Content: "images,backup",+ Shared: 1,+ Total: 1000,+ Used: 900,+ Available: 100,+ Nodes: "node1,node2",+ },+ },+ storageByNode: map[string][]proxmox.Storage{+ "node1": {+ {+ Storage: "shared-nfs",+ Type: "nfs",+ Content: "images,backup",+ Shared: 1,+ Enabled: 1,+ Active: 0,+ Total: 1000,+ Used: 900,+ Available: 100,+ },+ },+ "node2": {+ {+ Storage: "shared-nfs",+ Type: "nfs",+ Content: "images,backup",+ Shared: 1,+ Enabled: 1,+ Active: 1,+ Total: 1000,+ Used: 800,+ Available: 200,+ },+ },+ },+ }++ nodes := []proxmox.Node{+ {Node: "node1", Status: "online"},+ {Node: "node2", Status: "online"},+ }++ monitor.pollStorageWithNodes(context.Background(), "inst1", client, nodes)++ var shared *models.Storage+ for _, storage := range monitor.state.GetSnapshot().Storage {+ if storage.Name == "shared-nfs" {+ storageCopy := storage+ shared = &storageCopy+ break+ }+ }+ if shared == nil {+ t.Fatalf("expected shared storage in state, got %+v", monitor.state.GetSnapshot().Storage)+ }+ if shared.Node != "cluster" || !shared.Shared {+ t.Fatalf("expected cluster-scoped shared storage, got %+v", *shared)+ }+ if !shared.Enabled || !shared.Active {+ t.Fatalf("expected shared storage to remain enabled and active when any node is active, got %+v", *shared)+ }+ if shared.Status != "available" {+ t.Fatalf("expected shared storage status to stay available when any node is active, got %+v", *shared)+ }+ if shared.Total != 1000 || shared.Used != 900 || shared.Free != 100 {+ t.Fatalf("expected shared storage to retain best capacity sample, got %+v", *shared)+ }+}+func TestPollStorageWithNodesAttachesZFSPoolFromExplicitPoolField(t *testing.T) {t.Setenv("PULSE_DATA_DIR", t.TempDir())