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
Port v5 Ceph and Podman runtime compatibility
rcourtman84943907afff
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 01ce53d984..f5eda9ede1 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -41,14 +41,16 @@ truth for live infrastructure data.17. `internal/monitoring/vmware_poller.go`18. `internal/monitoring/monitored_system_usage.go`19. `internal/dockeragent/swarm.go`-20. `internal/monitoring/guest_memory_sources.go`-21. `internal/monitoring/guest_memory_stability.go`-22. `internal/monitoring/monitor_polling_vm.go`-23. `internal/monitoring/monitor_pve_guest_builders.go`-24. `internal/monitoring/monitor_pve_guest_poll.go`-25. `internal/monitoring/guest_disk_stability.go`-26. `internal/monitoring/mock_metrics_history.go`-27. `internal/monitoring/mock_chart_history.go`+20. `internal/dockeragent/collect.go`+21. `pkg/proxmox/ceph.go`+22. `internal/monitoring/guest_memory_sources.go`+23. `internal/monitoring/guest_memory_stability.go`+24. `internal/monitoring/monitor_polling_vm.go`+25. `internal/monitoring/monitor_pve_guest_builders.go`+26. `internal/monitoring/monitor_pve_guest_poll.go`+27. `internal/monitoring/guest_disk_stability.go`+28. `internal/monitoring/mock_metrics_history.go`+29. `internal/monitoring/mock_chart_history.go`## Shared Boundaries@@ -62,7 +64,9 @@ truth for live infrastructure data.4. Add unified supplemental ingest through `internal/monitoring/poll_providers.go`5. Add or change container startup ownership/bootstrap behavior for hosted or managed Pulse runtime mounts through `docker-entrypoint.sh`6. Add or change Docker Swarm manager task/service runtime collection through `internal/dockeragent/swarm.go`-7. Add or change mock chart synthesis, seeded history continuity, or mock-owned+7. Add or change Docker or Podman container stats compatibility and runtime metric semantics through `internal/dockeragent/collect.go`+8. Add or change Proxmox Ceph compatibility payload decoding through `pkg/proxmox/ceph.go`+9. Add or change mock chart synthesis, seeded history continuity, or mock-ownedchart fallbacks through `internal/monitoring/mock_metrics_history.go` and`internal/monitoring/mock_chart_history.go`@@ -76,7 +80,7 @@ truth for live infrastructure data.1. Update this contract when monitoring truth ownership changes2. Tighten guardrails when `GetState()`-centric paths are removed-3. Keep discovery-provider, guest-memory trust, metrics-history, Docker Swarm collection, and container bootstrap proof routes explicit in `registry.json`+3. Keep discovery-provider, guest-memory trust, metrics-history, Docker/Podman container collection, Proxmox Ceph compatibility, Docker Swarm collection, and container bootstrap proof routes explicit in `registry.json`4. Update related read-state or monitor tests when new collector paths land5. Keep platform ingestion semantics aligned with`docs/release-control/v6/internal/PLATFORM_SUPPORT_MODEL.md`: hybrid is a@@ -115,6 +119,13 @@ must emit canonical reason codes such as`supplemental_inventory_rebuild_pending` when usage cannot yet be resolved, socommercial surfaces can show verification or recovery state without inventingtheir own readiness heuristics or falling back to a fake `0 / limit`.+That same monitoring owner also governs collector payload compatibility at the+shared boundary. Podman container stats must honor Podman's compat payload when+it exposes a direct CPU percentage and otherwise fall back to Podman's+wall-clock delta semantics rather than Docker's multi-core normalization, and+Proxmox Ceph status decoding must accept manager standby entries as either bare+names or structured objects so collector payload variations do not break the+canonical monitoring path.VMware vSphere now also has a locked phase-1 ingestion boundary under thislane. The admitted direction is vCenter-only in phase 1, and monitoring muststay API-first through thediff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex 86a42a1bcf..51219a6cdf 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -3197,7 +3197,9 @@],"owned_files": ["docker-entrypoint.sh",- "internal/dockeragent/swarm.go"+ "internal/dockeragent/collect.go",+ "internal/dockeragent/swarm.go",+ "pkg/proxmox/ceph.go"],"verification": {"allow_same_subsystem_tests": true,@@ -3319,6 +3321,21 @@"internal/monitoring/node_memory_sources_test.go"]},+ {+ "id": "docker-collect-runtime",+ "label": "docker and podman container collection proof",+ "match_prefixes": [],+ "match_files": [+ "internal/dockeragent/collect.go"+ ],+ "allow_same_subsystem_tests": false,+ "test_prefixes": [],+ "exact_files": [+ "internal/dockeragent/agent_collect_test.go",+ "internal/dockeragent/agent_cpu_test.go",+ "internal/dockeragent/agent_internal_test.go"+ ]+ },{"id": "docker-swarm-runtime","label": "docker swarm runtime proof",@@ -3333,6 +3350,20 @@"internal/dockeragent/swarm_test.go"]},+ {+ "id": "proxmox-ceph-runtime",+ "label": "proxmox ceph compatibility proof",+ "match_prefixes": [],+ "match_files": [+ "pkg/proxmox/ceph.go"+ ],+ "allow_same_subsystem_tests": false,+ "test_prefixes": [],+ "exact_files": [+ "pkg/proxmox/ceph_test.go",+ "pkg/proxmox/cluster_client_api_test.go"+ ]+ },{"id": "container-entrypoint-runtime","label": "container entrypoint runtime proof",diff --git a/internal/dockeragent/agent_collect_test.go b/internal/dockeragent/agent_collect_test.goindex 9f3e326ed3..706d6fd637 100644--- a/internal/dockeragent/agent_collect_test.go+++ b/internal/dockeragent/agent_collect_test.go@@ -126,6 +126,64 @@ func TestCollectContainer(t *testing.T) {}})+ t.Run("podman uses reported cpu percent from compat stats payload", func(t *testing.T) {+ inspect := baseInspect()+ inspect.State = &containertypes.State{+ Running: true,+ StartedAt: time.Now().Add(-time.Minute).Format(time.RFC3339Nano),+ }++ agent := &Agent{+ runtime: RuntimePodman,+ logger: logger,+ prevContainerCPU: map[string]cpuSample{+ "container-123456": {+ totalUsage: 100_000_000,+ systemUsage: 1_000_000_000,+ onlineCPUs: 16,+ read: time.Now().Add(-time.Second),+ },+ },+ docker: &fakeDockerClient{+ containerInspectWithRawFn: func(context.Context, string, bool) (containertypes.InspectResponse, []byte, error) {+ return inspect, nil, nil+ },+ containerStatsOneShotFn: func(context.Context, string) (containertypes.StatsResponseReader, error) {+ payload := `{+ "read":"2026-04-09T12:00:00Z",+ "cpu_stats":{+ "cpu_usage":{"total_usage":130000000},+ "system_cpu_usage":1010000000,+ "online_cpus":16,+ "cpu":0.32,+ "throttling_data":{}+ },+ "precpu_stats":{},+ "memory_stats":{"usage":1000000,"limit":4000000,"stats":{"cache":200000}},+ "blkio_stats":{"io_service_bytes_recursive":[]}+ }`+ return containertypes.StatsResponseReader{Body: io.NopCloser(strings.NewReader(payload))}, nil+ },+ },+ }++ container, err := agent.collectContainer(context.Background(), containertypes.Summary{+ ID: "container-123456",+ Names: []string{"/app"},+ Image: "nginx:latest",+ ImageID: "sha256:local",+ Created: time.Now().Add(-time.Hour).Unix(),+ State: "running",+ Status: "Up",+ })+ if err != nil {+ t.Fatalf("unexpected error: %v", err)+ }+ if container.CPUPercent != 0.32 {+ t.Fatalf("expected podman cpu percent 0.32 from payload, got %f", container.CPUPercent)+ }+ })+t.Run("stopped container clears sample", func(t *testing.T) {agent := &Agent{logger: logger,diff --git a/internal/dockeragent/agent_cpu_test.go b/internal/dockeragent/agent_cpu_test.goindex 9224e8b35f..6a56e3a2ac 100644--- a/internal/dockeragent/agent_cpu_test.go+++ b/internal/dockeragent/agent_cpu_test.go@@ -1,6 +1,7 @@package dockeragentimport (+ "math""testing""time"@@ -323,4 +324,64 @@ func TestCalculateContainerCPUPercent(t *testing.T) {t.Fatalf("expected 0 on first call (manual tracking), got %f", got)}})++ t.Run("podman uses wall clock delta", func(t *testing.T) {+ now := time.Now()+ agent := &Agent{+ logger: logger,+ runtime: RuntimePodman,+ prevContainerCPU: map[string]cpuSample{+ "container-123456": {+ totalUsage: 1_000_000_000,+ systemUsage: 1_000,+ onlineCPUs: 16,+ read: now.Add(-time.Second),+ },+ },+ }++ stats := containertypes.StatsResponse{+ Read: now,+ CPUStats: containertypes.CPUStats{+ CPUUsage: containertypes.CPUUsage{TotalUsage: 1_250_000_000},+ SystemUsage: 2_000,+ OnlineCPUs: 16,+ },+ }++ got := agent.calculateContainerCPUPercent("container-123456", stats)+ if math.Abs(got-25.0) > 0.01 {+ t.Fatalf("expected podman cpu percent near 25.0, got %f", got)+ }+ })+}++func TestDecodeContainerStatsPayloadExtractsPodmanCPU(t *testing.T) {+ payload := []byte(`{+ "read":"2026-04-09T12:00:00Z",+ "cpu_stats":{+ "cpu_usage":{"total_usage":123456789},+ "system_cpu_usage":987654321,+ "online_cpus":16,+ "cpu":0.32,+ "throttling_data":{}+ },+ "precpu_stats":{},+ "memory_stats":{"usage":1000,"limit":2000,"stats":{"cache":100}},+ "blkio_stats":{"io_service_bytes_recursive":[]}+ }`)++ stats, podmanCPU, err := decodeContainerStatsPayload(payload)+ if err != nil {+ t.Fatalf("unexpected decode error: %v", err)+ }+ if stats.CPUStats.CPUUsage.TotalUsage != 123456789 {+ t.Fatalf("expected total usage 123456789, got %d", stats.CPUStats.CPUUsage.TotalUsage)+ }+ if podmanCPU == nil {+ t.Fatal("expected podman cpu percent to be extracted")+ }+ if math.Abs(*podmanCPU-0.32) > 0.000001 {+ t.Fatalf("expected podman cpu percent 0.32, got %f", *podmanCPU)+ }}diff --git a/internal/dockeragent/collect.go b/internal/dockeragent/collect.goindex c581a1fb3f..319a53eb64 100644--- a/internal/dockeragent/collect.go+++ b/internal/dockeragent/collect.go@@ -5,6 +5,7 @@ import ("crypto/rand""encoding/json""fmt"+ "io""math""math/big""strconv"@@ -267,12 +268,21 @@ func (a *Agent) collectContainer(ctx context.Context, summary containertypes.Sum}}()- var stats containertypes.StatsResponse- if err := json.NewDecoder(statsResp.Body).Decode(&stats); err != nil {+ payload, err := io.ReadAll(statsResp.Body)+ if err != nil {+ return agentsdocker.Container{}, fmt.Errorf("read stats: %w", err)+ }++ stats, podmanCPUPercent, err := decodeContainerStatsPayload(payload)+ if err != nil {return agentsdocker.Container{}, fmt.Errorf("decode stats: %w", err)}- cpuPercent = a.calculateContainerCPUPercent(summary.ID, stats)+ if a.runtime == RuntimePodman && podmanCPUPercent != nil {+ cpuPercent = safeFloat(*podmanCPUPercent)+ } else {+ cpuPercent = a.calculateContainerCPUPercent(summary.ID, stats)+ }memUsage, memLimit, memPercent = calculateMemoryUsage(stats)blockIO = summarizeBlockIO(stats)networkRX, networkTX = summarizeNetworkIO(stats)@@ -601,6 +611,26 @@ func extractPodmanMetadata(labels map[string]string) *agentsdocker.PodmanContainreturn meta}+type podmanCompatStatsProbe struct {+ CPUStats struct {+ CPU *float64 `json:"cpu"`+ } `json:"cpu_stats"`+}++func decodeContainerStatsPayload(payload []byte) (containertypes.StatsResponse, *float64, error) {+ var stats containertypes.StatsResponse+ if err := json.Unmarshal(payload, &stats); err != nil {+ return containertypes.StatsResponse{}, nil, err+ }++ var probe podmanCompatStatsProbe+ if err := json.Unmarshal(payload, &probe); err != nil {+ return stats, nil, nil+ }++ return stats, probe.CPUStats.CPU, nil+}+func (a *Agent) calculateContainerCPUPercent(containerID string, stats containertypes.StatsResponse) float64 {a.cpuMu.Lock()defer a.cpuMu.Unlock()@@ -645,6 +675,34 @@ func (a *Agent) calculateContainerCPUPercent(containerID string, stats containerreturn 0}+ if a.runtime == RuntimePodman {+ if !prev.read.IsZero() && !current.read.IsZero() {+ elapsed := current.read.Sub(prev.read).Seconds()+ if elapsed > 0 {+ denominator := elapsed * 1e9+ if denominator > 0 {+ cpuPercent := (totalDelta / denominator) * 100.0+ result := safeFloat(cpuPercent)+ a.logger.Debug().+ Str("container_id", containerID[:12]).+ Float64("cpu_percent", result).+ Float64("total_delta", totalDelta).+ Float64("elapsed_seconds", elapsed).+ Msg("CPU calculated from Podman wall-clock delta")+ return result+ }+ }+ }++ a.logger.Debug().+ Str("container_id", containerID[:12]).+ Float64("total_delta", totalDelta).+ Bool("prev_read_zero", prev.read.IsZero()).+ Bool("current_read_zero", current.read.IsZero()).+ Msg("Podman CPU calculation failed: no valid wall-clock delta available")+ return 0+ }+onlineCPUs := current.onlineCPUsif onlineCPUs == 0 {onlineCPUs = prev.onlineCPUsdiff --git a/pkg/proxmox/ceph.go b/pkg/proxmox/ceph.goindex df87e72960..6b06cdf35d 100644--- a/pkg/proxmox/ceph.go+++ b/pkg/proxmox/ceph.go@@ -3,6 +3,7 @@ package proxmoximport ("context""encoding/json"+ "strings")// CephStatus represents the Ceph cluster status information returned by /cluster/ceph/status@@ -72,6 +73,48 @@ type CephMgrMap struct {Standbys []string `json:"standbys"`}+func (m *CephMgrMap) UnmarshalJSON(data []byte) error {+ type rawCephMgrMap struct {+ Available bool `json:"available"`+ NumMgrs int `json:"num_mgrs"`+ ActiveName string `json:"active_name"`+ Standbys []json.RawMessage `json:"standbys"`+ }++ var raw rawCephMgrMap+ if err := json.Unmarshal(data, &raw); err != nil {+ return err+ }++ m.Available = raw.Available+ m.NumMgrs = raw.NumMgrs+ m.ActiveName = raw.ActiveName+ m.Standbys = m.Standbys[:0]++ for _, standby := range raw.Standbys {+ var name string+ if err := json.Unmarshal(standby, &name); err == nil {+ name = strings.TrimSpace(name)+ if name != "" {+ m.Standbys = append(m.Standbys, name)+ }+ continue+ }++ var named struct {+ Name string `json:"name"`+ }+ if err := json.Unmarshal(standby, &named); err == nil {+ name = strings.TrimSpace(named.Name)+ if name != "" {+ m.Standbys = append(m.Standbys, name)+ }+ }+ }++ return nil+}+// CephOSDMap captures summary statistics about OSDs.type CephOSDMap struct {NumOSDs int `json:"num_osds"`diff --git a/pkg/proxmox/ceph_test.go b/pkg/proxmox/ceph_test.goindex 6950eb17e5..b630df9179 100644--- a/pkg/proxmox/ceph_test.go+++ b/pkg/proxmox/ceph_test.go@@ -63,6 +63,63 @@ func TestGetCephStatus(t *testing.T) {}}+func TestGetCephStatusAcceptsStructuredManagerStandbys(t *testing.T) {+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.URL.Path != "/cluster/ceph/status" {+ http.NotFound(w, r)+ return+ }+ resp := map[string]interface{}{+ "data": map[string]interface{}{+ "fsid": "fsid-1",+ "health": map[string]interface{}{+ "status": "HEALTH_OK",+ "summary": []map[string]interface{}{},+ "checks": map[string]interface{}{},+ },+ "servicemap": map[string]interface{}{+ "services": map[string]interface{}{},+ },+ "monmap": map[string]interface{}{+ "num_mons": 3,+ },+ "mgrmap": map[string]interface{}{+ "available": true,+ "num_mgrs": 3,+ "active_name": "mgr-a",+ "standbys": []map[string]interface{}{+ {"name": "mgr-b"},+ {"name": "mgr-c"},+ },+ },+ "osdmap": map[string]interface{}{+ "num_osds": 1,+ "num_up_osds": 1,+ "num_in_osds": 1,+ },+ "pgmap": map[string]interface{}{+ "num_pgs": 5,+ },+ },+ }+ _ = json.NewEncoder(w).Encode(resp)+ }))+ defer server.Close()++ client := &Client{baseURL: server.URL, httpClient: server.Client()}+ status, err := client.GetCephStatus(context.Background())+ if err != nil {+ t.Fatalf("unexpected error: %v", err)+ }++ if len(status.MgrMap.Standbys) != 2 {+ t.Fatalf("expected 2 standbys, got %+v", status.MgrMap.Standbys)+ }+ if status.MgrMap.Standbys[0] != "mgr-b" || status.MgrMap.Standbys[1] != "mgr-c" {+ t.Fatalf("expected structured standbys to decode into names, got %+v", status.MgrMap.Standbys)+ }+}+func TestGetCephDF(t *testing.T) {server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {if r.URL.Path != "/cluster/ceph/df" {diff --git a/scripts/release_control/canonical_completion_guard_test.py b/scripts/release_control/canonical_completion_guard_test.pyindex df68401440..0c05ef5efd 100644--- a/scripts/release_control/canonical_completion_guard_test.py+++ b/scripts/release_control/canonical_completion_guard_test.py@@ -213,7 +213,9 @@ class CanonicalCompletionGuardTest(unittest.TestCase):"metrics-history-runtime","storage-risk-runtime","memory-source-runtime",+ "docker-collect-runtime","docker-swarm-runtime",+ "proxmox-ceph-runtime","container-entrypoint-runtime","monitoring-runtime",],@@ -235,6 +237,67 @@ class CanonicalCompletionGuardTest(unittest.TestCase):],)+ def test_docker_collect_runtime_change_requires_monitoring_contract(self):+ required = infer_impacted_subsystems(["internal/dockeragent/collect.go"])+ self.assertEqual(set(required), {"monitoring"})++ monitoring = required["monitoring"]+ self.assertEqual(+ monitoring["contract"],+ "docs/release-control/v6/internal/subsystems/monitoring.md",+ )+ self.assertEqual(+ monitoring["touched_runtime_files"],+ ["internal/dockeragent/collect.go"],+ )+ self.assertEqual(+ monitoring["verification_requirements"],+ [+ {+ "id": "docker-collect-runtime",+ "label": "docker and podman container collection proof",+ "touched_runtime_files": ["internal/dockeragent/collect.go"],+ "allow_same_subsystem_tests": False,+ "test_prefixes": [],+ "exact_files": [+ "internal/dockeragent/agent_collect_test.go",+ "internal/dockeragent/agent_cpu_test.go",+ "internal/dockeragent/agent_internal_test.go",+ ],+ }+ ],+ )++ def test_proxmox_ceph_runtime_change_requires_monitoring_contract(self):+ required = infer_impacted_subsystems(["pkg/proxmox/ceph.go"])+ self.assertEqual(set(required), {"monitoring"})++ monitoring = required["monitoring"]+ self.assertEqual(+ monitoring["contract"],+ "docs/release-control/v6/internal/subsystems/monitoring.md",+ )+ self.assertEqual(+ monitoring["touched_runtime_files"],+ ["pkg/proxmox/ceph.go"],+ )+ self.assertEqual(+ monitoring["verification_requirements"],+ [+ {+ "id": "proxmox-ceph-runtime",+ "label": "proxmox ceph compatibility proof",+ "touched_runtime_files": ["pkg/proxmox/ceph.go"],+ "allow_same_subsystem_tests": False,+ "test_prefixes": [],+ "exact_files": [+ "pkg/proxmox/ceph_test.go",+ "pkg/proxmox/cluster_client_api_test.go",+ ],+ }+ ],+ )+def test_storage_risk_runtime_change_requires_monitoring_contract(self):required = infer_impacted_subsystems(["internal/storagehealth/topology.go"])self.assertEqual(set(required), {"monitoring"})