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.

Fix VMware inventory metric clone race and exempt docker-swarm-node from legacy-host-label assertion

rcourtman802b3aac4926
diff --git a/internal/mock/fixture_graph.go b/internal/mock/fixture_graph.go
index f3515a25fb..177a9737b5 100644
--- a/internal/mock/fixture_graph.go
+++ b/internal/mock/fixture_graph.go
@@ -348,6 +348,10 @@ func cloneVMwareInventoryMetrics(in *vmware.InventoryMetrics) *vmware.InventoryM
out.NetOutBytesPerSecond = cloneFloat64Ptr(in.NetOutBytesPerSecond)
out.DiskReadBytesPerSecond = cloneFloat64Ptr(in.DiskReadBytesPerSecond)
out.DiskWriteBytesPerSecond = cloneFloat64Ptr(in.DiskWriteBytesPerSecond)
+ out.UptimeSeconds = cloneInt64Ptr(in.UptimeSeconds)
+ out.DiskUsedBytes = cloneInt64Ptr(in.DiskUsedBytes)
+ out.DiskTotalBytes = cloneInt64Ptr(in.DiskTotalBytes)
+ out.DiskPercent = cloneFloat64Ptr(in.DiskPercent)
return &out
}
diff --git a/internal/monitoring/monitor_unified_state_test.go b/internal/monitoring/monitor_unified_state_test.go
index 955af2779c..0fd2d6c024 100644
--- a/internal/monitoring/monitor_unified_state_test.go
+++ b/internal/monitoring/monitor_unified_state_test.go
@@ -241,6 +241,26 @@ func hasFrontendResourceName(resources []models.ResourceFrontend, name string) b
return false
}
+// hasFrontendResourceNameForHostType returns true only when a docker-host or
+// proxmox-node-shaped resource carries the literal Name. Docker Swarm nodes
+// added in 89abed099 legitimately publish the swarm-node hostname (e.g.
+// "edge-apps-01") as their Name because that is how Docker Swarm identifies
+// members; the canonical legacy-label rejection rules below apply only to
+// the host-type resources that previously surfaced the lowercase-hyphenated
+// host hostname instead of the canonical DisplayName.
+func hasFrontendResourceNameForHostType(resources []models.ResourceFrontend, name string) bool {
+ for _, resource := range resources {
+ if resource.Name != name {
+ continue
+ }
+ switch resource.Type {
+ case "docker-host", "agent", "node":
+ return true
+ }
+ }
+ return false
+}
+
func TestMonitorGetUnifiedReadStateOrSnapshotUsesStoreResourcesWithoutSnapshotFallback(t *testing.T) {
now := time.Date(2026, 3, 6, 12, 0, 0, 0, time.UTC)
store := &resourceOnlyStore{
@@ -493,10 +513,10 @@ func TestMonitorBuildBroadcastFrontendStateUsesCanonicalMockUnifiedResources(t *
if !hasFrontendResourceName(frontend.Resources, "truenas-main") {
t.Fatalf("expected mock-mode broadcast state to include TrueNAS mock resources, got %#v", frontend.Resources)
}
- if hasFrontendResourceName(frontend.Resources, "pve1") {
+ if hasFrontendResourceNameForHostType(frontend.Resources, "pve1") {
t.Fatalf("expected mock-mode broadcast state to stop publishing legacy proxmox node labels, got %#v", frontend.Resources)
}
- if hasFrontendResourceName(frontend.Resources, "edge-apps-01") {
+ if hasFrontendResourceNameForHostType(frontend.Resources, "edge-apps-01") {
t.Fatalf("expected mock-mode broadcast state to stop publishing legacy docker host labels, got %#v", frontend.Resources)
}
if !hasFrontendResourceName(frontend.Resources, "esxi-01.lab.local") {