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
Normalize Docker container CPU capacity
rcourtmanb1fdefdd50bd
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 338b3c946e..b943f49b53 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -107,6 +107,11 @@ and owns the Docker / Podman collection module used by `pulse-agent`, butDocker runtime capability truth is monitoring-owned. Lifecycle consumers mustnot reinterpret standalone `Swarm.LocalNodeState=inactive` metadata as agentenrollment, install, command, or fleet-control authority.+The Docker / Podman module reports runtime-native per-core container CPU+percent because that is the collector's source evidence. Lifecycle surfaces may+transport that report, but must not reinterpret it as host-capacity utilization;+monitoring and unified resources own the normalized CPU contract used by+history, alerts, and canonical app-container metrics.Inside-guest Docker / Podman visibility is also a privacy boundary: fullDocker / Podman inventory may come from a guest-local agent or another explicitguest reporting path. LXC Docker inventory may also come from the Proxmox hostdiff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 97447832f0..062ac96ec5 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -17,6 +17,10 @@Own alert identity, alert specs, evaluation, persistence semantics, andoperator-facing alert routing behavior for live runtime alerts.+Docker and Podman container CPU thresholds evaluate host-capacity-normalized+CPU percent, not Docker's runtime-native per-core percent. Alert metadata may+carry the raw per-core value and reporting host CPU count for evidence, but the+threshold value and canonical `cpuPercent` metadata remain normalized.## Canonical Filesdiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex e3cff853c2..9a8ee9557c 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -173,6 +173,13 @@ or retain full frontend-state payloads at the handler boundary. The WebSockethub owns tenant-aware state resolution after coalescing, through the same stategetter that backs the canonical `/api/state` payload.+Docker and Podman app-container CPU payloads expose two API facts with+different meanings: canonical resource metrics and `/api/metrics-store/history`+CPU fallback points use host-capacity-normalized percent, while Docker metadata+may expose runtime-native per-core CPU percent plus the host CPU count as raw+diagnostic evidence. API consumers must not treat raw per-core CPU as the+threshold, chart, or canonical resource CPU value.+Candidate import plans for PVE/PBS/PMG onboarding are API-contract consumers,not local UI estimates. Probe and Discovery candidates must build theirpreview through `frontend-modern/src/api/monitoredSystemLedger.ts` anddiff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 00b454937b..13d61ed5c9 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -35,6 +35,11 @@ configured cluster labels must project into node display names as`cluster label (node name)` so duplicate node hostnames across clusters remaindistinguishable, while `models.Node.Name` and `ProxmoxData.NodeName` keep theraw Proxmox node identity for linking, metrics, URLs, and actions.+Docker and Podman container CPU collection preserves the runtime-native raw+per-core CPU percent, but monitoring-owned history and alert threshold+evaluation use host-capacity-normalized CPU percent when host CPU capacity is+known. Raw runtime CPU remains alert/resource metadata, not the canonical+threshold value.## Canonical Files@@ -168,6 +173,11 @@ raw Proxmox node identity for linking, metrics, URLs, and actions.fail when container/runtime health data is otherwise usable. Podman libpodpods remain outside this collector until a libpod-native collector owns thatAPI shape.+ Docker's native CPU convention reports 100% per CPU core. Agent reports and+ compatibility APIs may keep that raw value, but canonical monitoring history+ and Docker container CPU alerts must pass through the shared normalized+ capacity helper so an 80% threshold means 80% of the reporting host capacity,+ not 0.8 of one core on a multi-core host.8. Add or change Proxmox Ceph compatibility payload decoding through `pkg/proxmox/ceph.go`9. Add or change Proxmox ZFS compatibility payload decoding and vdev-role normalization through `pkg/proxmox/zfs.go`10. Add or change mock chart synthesis, seeded history continuity, or mock-owneddiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 812331949b..af031f8c37 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -220,6 +220,11 @@ regression protection.validate request-body setup tokens, but the router-level public-path check muststay O(1) and must not front-run persistence loads, monitor refresh, or otherteardown/register side effects before the canonical handler owns the request.+ Metrics-history live fallback for Docker / Podman app-container CPU may read+ the already-loaded Docker host snapshot to normalize per-core CPU by host+ CPU capacity. It must remain inside the existing lazy fallback-state load and+ must not add container-runtime calls, persistence scans, or extra unified+ resource walks to the protected history endpoint.Test seams around the router's relay runtime client may expose the currentrelay status to onboarding handlers, but they must remain in-memoryinterface boundaries and must not add persistence probes, network reconnects,diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.mdindex d370358d46..fb731fb516 100644--- a/docs/release-control/v6/internal/subsystems/security-privacy.md+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md@@ -158,6 +158,12 @@ command, prompt, or remediation payload into the model beyond the existingscoped-investigation context, so it adds no new disclosure surface and theexisting resource-policy redaction still governs any model-bound context.+Docker and Podman container CPU normalization may expose numeric raw per-core+CPU percent, normalized capacity percent, and reporting host CPU count in+resource or alert metadata. Those fields are operational usage telemetry only;+they must not be expanded into command lines, environment variables, secret+material, or unbounded container inspection output at the API boundary.+1. Change privacy disclosures, usage-data vocabulary, or outbound-data guarantees through `docs/PRIVACY.md`, `frontend-modern/public/docs/PRIVACY.md`, `internal/telemetry/telemetry.go`, and `pkg/server/telemetry_pulse_intelligence.go` together.Pulse Intelligence external-agent/MCP telemetry may expose only content-freeadapter-origin usage and capability-class counters for context, eventdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex e61aeff4b4..c856fbfb80 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -70,6 +70,12 @@ surfaces. Recovery code may consume the API-ownedmobile pairing QR/deep-link payload from relay settings when relayregistration or the dedicated Pulse Mobile credential is incomplete.+Docker and Podman app-container CPU fields on unified resource metadata are+storage/recovery-adjacent only because `DockerData` is a shared resource+payload. Raw per-core CPU evidence and normalized capacity CPU must not be used+as backup coverage, restore readiness, storage-health, or recovery-point+signals.+Shared command-agent token binding in `internal/api/agent_exec_token_binding.go`is API-owned adjacent infrastructure. Storage- and recovery-adjacent setup ordiagnostics flows may observe the API-owned `bound_agent_id`,diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 45ab820411..16ce4ea41e 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -17,6 +17,10 @@Own canonical resource identity, type normalization, typed views, andcross-source deduplication.+For Docker and Podman container resources, the canonical CPU metric represents+host-capacity-normalized utilization. Runtime-native per-core CPU percent is+kept on Docker metadata as raw evidence and must not replace the canonical+metric or threshold surface.## Canonical Filesdiff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.tsindex f9c706016a..32d75feeea 100644--- a/frontend-modern/src/types/resource.ts+++ b/frontend-modern/src/types/resource.ts@@ -704,6 +704,9 @@ export interface ResourceDockerMeta {health?: string;restartCount?: number;exitCode?: number;+ cpuRawPercent?: number;+ cpuCapacityPercent?: number;+ cpuCapacityCores?: number;finishedAt?: string;blockIo?: {readBytes?: number;diff --git a/internal/alerts/alerts_test.go b/internal/alerts/alerts_test.goindex fb9397587d..fce5c7a1ec 100644--- a/internal/alerts/alerts_test.go+++ b/internal/alerts/alerts_test.go@@ -2273,6 +2273,59 @@ func TestCheckDockerHostIgnoresContainersByPrefix(t *testing.T) {}}+func TestCheckDockerHostContainerCPUUsesCapacityNormalizedPercent(t *testing.T) {+ m := newTestManager(t)+ cfg := m.GetConfig()+ cfg.Enabled = true+ cfg.DockerDefaults.CPU = HysteresisThreshold{Trigger: 80, Clear: 70}+ m.UpdateConfig(cfg)+ m.mu.Lock()+ m.config.TimeThresholds = map[string]int{}+ m.config.MetricTimeThresholds = nil+ m.mu.Unlock()++ host := models.DockerHost{+ ID: "docker-host",+ Hostname: "docker-host",+ DisplayName: "Docker Host",+ CPUs: 4,+ Containers: []models.DockerContainer{{+ ID: "container-1",+ Name: "transcoder",+ State: "running",+ Status: "running",+ CPUPercent: 240,+ }},+ }+ alertID := canonicalMetricStateID(dockerResourceID(host.ID, "container-1"), "cpu")++ m.CheckDockerHost(host)+ m.mu.RLock()+ _, exists := testLookupActiveAlert(t, m, alertID)+ m.mu.RUnlock()+ if exists {+ t.Fatal("240% raw Docker CPU on a 4-core host should be 60% capacity and stay below the 80% threshold")+ }++ host.Containers[0].CPUPercent = 360+ m.CheckDockerHost(host)+ m.mu.RLock()+ alert, exists := testLookupActiveAlert(t, m, alertID)+ m.mu.RUnlock()+ if !exists {+ t.Fatal("360% raw Docker CPU on a 4-core host should be 90% capacity and trigger the 80% threshold")+ }+ if alert.Value != 90 {+ t.Fatalf("alert value = %v, want normalized capacity percent 90", alert.Value)+ }+ if got := alert.Metadata["cpuRawPercent"]; got != float64(360) {+ t.Fatalf("alert raw CPU metadata = %#v, want 360", got)+ }+ if got := alert.Metadata["cpuCapacityCores"]; got != 4 {+ t.Fatalf("alert CPU capacity cores metadata = %#v, want 4", got)+ }+}+func TestDockerServiceReplicaAlerts(t *testing.T) {m := newTestManager(t)m.ClearActiveAlerts()diff --git a/internal/alerts/docker.go b/internal/alerts/docker.goindex cc2c6240ff..dd4339035f 100644--- a/internal/alerts/docker.go+++ b/internal/alerts/docker.go@@ -297,19 +297,23 @@ func (m *Manager) evaluateDockerContainer(host models.DockerHost, container mode}if thresholds.CPU != nil {+ cpuCapacityPercent := models.DockerContainerCPUCapacityPercent(container, host.CPUs)cpuMetadata := map[string]interface{}{- "resourceType": resourceType,- "hostId": host.ID,- "hostName": host.DisplayName,- "hostHostname": host.Hostname,- "containerId": container.ID,- "containerName": containerName,- "image": container.Image,- "state": container.State,- "status": container.Status,- "restartCount": container.RestartCount,- "metric": "cpu",- "cpuPercent": container.CPUPercent,+ "resourceType": resourceType,+ "hostId": host.ID,+ "hostName": host.DisplayName,+ "hostHostname": host.Hostname,+ "containerId": container.ID,+ "containerName": containerName,+ "image": container.Image,+ "state": container.State,+ "status": container.Status,+ "restartCount": container.RestartCount,+ "metric": "cpu",+ "cpuPercent": cpuCapacityPercent,+ "cpuCapacityPercent": cpuCapacityPercent,+ "cpuRawPercent": container.CPUPercent,+ "cpuCapacityCores": host.CPUs,}spec, err := buildCanonicalMetricSpec(resourceID, containerName, unifiedresources.ResourceTypeAppContainer, "cpu", thresholds.CPU)if err != nil {@@ -319,7 +323,7 @@ func (m *Manager) evaluateDockerContainer(host models.DockerHost, container modeStr("container", containerName).Msg("Skipping invalid canonical docker container CPU metric spec")} else {- m.checkMetricWithCanonicalSpec(spec, containerName, nodeName, instanceName, resourceType, container.CPUPercent, thresholds.CPU, &metricOptions{Metadata: cpuMetadata})+ m.checkMetricWithCanonicalSpec(spec, containerName, nodeName, instanceName, resourceType, cpuCapacityPercent, thresholds.CPU, &metricOptions{Metadata: cpuMetadata})}}diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 0c2f23da70..bacf86ec54 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -10696,6 +10696,53 @@ func TestContract_MetricsHistoryLiveFallbackJSONSnapshot(t *testing.T) {assertJSONSnapshot(t, got, want)}+func TestContract_MetricsHistoryDockerContainerCPUFallbackUsesCapacityPercent(t *testing.T) {+ state := models.NewState()+ state.UpsertDockerHost(models.DockerHost{+ ID: "docker-host-contract-cpu",+ Hostname: "docker-host-contract-cpu",+ CPUs: 4,+ Containers: []models.DockerContainer{{+ ID: "container-contract-cpu",+ Name: "api",+ State: "running",+ CPUPercent: 240,+ MemoryPercent: 50,+ }},+ })++ monitor := &monitoring.Monitor{}+ setUnexportedField(t, monitor, "state", state)+ setUnexportedField(t, monitor, "metricsHistory", monitoring.NewMetricsHistory(10, time.Hour))++ router := &Router{monitor: monitor}+ req := httptest.NewRequest(+ http.MethodGet,+ "/api/metrics-store/history?resourceType=app-container&resourceId=container-contract-cpu&metric=cpu&range=5m",+ nil,+ )+ rec := httptest.NewRecorder()+ router.handleMetricsHistory(rec, req)++ if rec.Code != http.StatusOK {+ t.Fatalf("status = %d, body=%s", rec.Code, rec.Body.String())+ }++ var resp metricsHistoryResponse+ if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {+ t.Fatalf("unmarshal metrics history response: %v", err)+ }+ if resp.ResourceType != "app-container" || resp.ResourceId != "container-contract-cpu" || resp.Metric != "cpu" {+ t.Fatalf("unexpected metrics history identity: %+v", resp)+ }+ if resp.Source != "live" {+ t.Fatalf("expected live fallback source, got %q", resp.Source)+ }+ if len(resp.Points) != 1 || resp.Points[0].Value != 60 {+ t.Fatalf("Docker container CPU fallback points = %+v, want one normalized value 60", resp.Points)+ }+}+func TestContract_MetricsHistoryAgentTemperatureLiveFallback(t *testing.T) {state := models.NewState()state.UpsertHost(models.Host{diff --git a/internal/api/router.go b/internal/api/router.goindex e793c481b9..44b840d65f 100644--- a/internal/api/router.go+++ b/internal/api/router.go@@ -8962,17 +8962,17 @@ func (r *Router) handleMetricsHistory(w http.ResponseWriter, req *http.Request)return nil}- findDockerContainer := func(id string) *models.DockerContainer {+ findDockerContainer := func(id string) (*models.DockerContainer, int) {loadFallbackState()for i := range dockerHosts {host := &dockerHosts[i]for j := range host.Containers {if host.Containers[j].ID == id {- return &host.Containers[j]+ return &host.Containers[j], host.CPUs}}}- return nil+ return nil, 0}findDisk := func(id string) *unifiedresources.Resource {@@ -9100,11 +9100,11 @@ func (r *Router) handleMetricsHistory(w http.ResponseWriter, req *http.Request)points["temperature"] = monitoring.MetricPoint{Timestamp: now, Value: *temperature}}case "app-container":- container := findDockerContainer(resourceID)+ container, hostCPUs := findDockerContainer(resourceID)if container == nil {return points}- points["cpu"] = monitoring.MetricPoint{Timestamp: now, Value: container.CPUPercent}+ points["cpu"] = monitoring.MetricPoint{Timestamp: now, Value: models.DockerContainerCPUCapacityPercent(*container, hostCPUs)}points["memory"] = monitoring.MetricPoint{Timestamp: now, Value: container.MemoryPercent}if container.RootFilesystemBytes > 0 && container.WritableLayerBytes > 0 {diskPercent := float64(container.WritableLayerBytes) / float64(container.RootFilesystemBytes) * 100diff --git a/internal/models/converters.go b/internal/models/converters.goindex 2ac2c78d1d..d4869fe970 100644--- a/internal/models/converters.go+++ b/internal/models/converters.go@@ -558,6 +558,7 @@ func (c DockerContainer) ToFrontend() DockerContainerFrontend {Status: c.Status,Health: c.Health,CPUPercent: c.CPUPercent,+ CPUCapacityPercent: c.CPUCapacityPercent,MemoryUsage: c.MemoryUsage,MemoryLimit: c.MemoryLimit,MemoryPercent: c.MemoryPercent,diff --git a/internal/models/docker_cpu.go b/internal/models/docker_cpu.gonew file mode 100644index 0000000000..625f025d1f--- /dev/null+++ b/internal/models/docker_cpu.go@@ -0,0 +1,26 @@+package models++import "math"++// NormalizeDockerContainerCPUCapacityPercent converts Docker's per-core CPU+// convention into host-capacity percentage. Docker reports 100% per CPU, so a+// container using all of a 4-vCPU host can report 400% raw CPU.+func NormalizeDockerContainerCPUCapacityPercent(rawPercent float64, hostCPUs int) float64 {+ if math.IsNaN(rawPercent) || math.IsInf(rawPercent, 0) || rawPercent <= 0 {+ return 0+ }+ if hostCPUs > 1 {+ rawPercent = rawPercent / float64(hostCPUs)+ }+ if rawPercent > 100 {+ return 100+ }+ return rawPercent+}++func DockerContainerCPUCapacityPercent(container DockerContainer, hostCPUs int) float64 {+ if container.CPUCapacityPercent > 0 {+ return NormalizeDockerContainerCPUCapacityPercent(container.CPUCapacityPercent, 1)+ }+ return NormalizeDockerContainerCPUCapacityPercent(container.CPUPercent, hostCPUs)+}diff --git a/internal/models/docker_cpu_test.go b/internal/models/docker_cpu_test.gonew file mode 100644index 0000000000..017b6f85e5--- /dev/null+++ b/internal/models/docker_cpu_test.go@@ -0,0 +1,41 @@+package models++import (+ "math"+ "testing"+)++func TestNormalizeDockerContainerCPUCapacityPercent(t *testing.T) {+ tests := []struct {+ name string+ raw float64+ hostCPUs int+ want float64+ }{+ {name: "single core keeps raw percent", raw: 75, hostCPUs: 1, want: 75},+ {name: "multi core normalizes Docker core percent", raw: 240, hostCPUs: 4, want: 60},+ {name: "capacity percent clamps at 100", raw: 450, hostCPUs: 4, want: 100},+ {name: "unknown core count clamps raw to capacity ceiling", raw: 150, hostCPUs: 0, want: 100},+ {name: "negative raw percent returns zero", raw: -10, hostCPUs: 4, want: 0},+ {name: "nan raw percent returns zero", raw: math.NaN(), hostCPUs: 4, want: 0},+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ if got := NormalizeDockerContainerCPUCapacityPercent(tt.raw, tt.hostCPUs); got != tt.want {+ t.Fatalf("NormalizeDockerContainerCPUCapacityPercent(%v, %d) = %v, want %v", tt.raw, tt.hostCPUs, got, tt.want)+ }+ })+ }+}++func TestDockerContainerCPUCapacityPercentPrefersPersistedCapacity(t *testing.T) {+ container := DockerContainer{+ CPUPercent: 240,+ CPUCapacityPercent: 62.5,+ }++ if got := DockerContainerCPUCapacityPercent(container, 4); got != 62.5 {+ t.Fatalf("DockerContainerCPUCapacityPercent() = %v, want persisted capacity percent", got)+ }+}diff --git a/internal/models/models.go b/internal/models/models.goindex 7efc743998..8f420c0d01 100644--- a/internal/models/models.go+++ b/internal/models/models.go@@ -841,6 +841,7 @@ type DockerContainer struct {Status string `json:"status"`Health string `json:"health,omitempty"`CPUPercent float64 `json:"cpuPercent"`+ CPUCapacityPercent float64 `json:"cpuCapacityPercent,omitempty"`MemoryUsage int64 `json:"memoryUsageBytes"`MemoryLimit int64 `json:"memoryLimitBytes"`MemoryPercent float64 `json:"memoryPercent"`diff --git a/internal/models/models_frontend.go b/internal/models/models_frontend.goindex 4b3ddf3520..c13b15f571 100644--- a/internal/models/models_frontend.go+++ b/internal/models/models_frontend.go@@ -447,6 +447,7 @@ type DockerContainerFrontend struct {Status string `json:"status"`Health string `json:"health,omitempty"`CPUPercent float64 `json:"cpuPercent"`+ CPUCapacityPercent float64 `json:"cpuCapacityPercent,omitempty"`MemoryUsage int64 `json:"memoryUsageBytes"`MemoryLimit int64 `json:"memoryLimitBytes"`MemoryPercent float64 `json:"memoryPercent"`diff --git a/internal/monitoring/monitor_agents.go b/internal/monitoring/monitor_agents.goindex 4b3d9e8c94..cbd35d68b4 100644--- a/internal/monitoring/monitor_agents.go+++ b/internal/monitoring/monitor_agents.go@@ -1206,6 +1206,7 @@ func (m *Monitor) ApplyDockerReport(report agentsdocker.Report, tokenRecord *conNetworkRXBytes: payload.NetworkRXBytes,NetworkTXBytes: payload.NetworkTXBytes,}+ container.CPUCapacityPercent = models.DockerContainerCPUCapacityPercent(container, report.Host.TotalCPU)// Copy update status if provided by agentif payload.UpdateStatus != nil {@@ -1548,7 +1549,7 @@ func (m *Monitor) ApplyDockerReport(report agentsdocker.Report, tokenRecord *con}if m.metricsHistory != nil {- m.metricsHistory.AddGuestMetric(metricKey, "cpu", container.CPUPercent, now)+ m.metricsHistory.AddGuestMetric(metricKey, "cpu", models.DockerContainerCPUCapacityPercent(container, host.CPUs), now)m.metricsHistory.AddGuestMetric(metricKey, "memory", container.MemoryPercent, now)m.metricsHistory.AddGuestMetric(metricKey, "disk", diskPercent, now)if container.NetInRate >= 0 {@@ -1566,7 +1567,7 @@ func (m *Monitor) ApplyDockerReport(report agentsdocker.Report, tokenRecord *con}if m.metricsStore != nil {- m.metricsStore.Write("dockerContainer", container.ID, "cpu", container.CPUPercent, now)+ m.metricsStore.Write("dockerContainer", container.ID, "cpu", models.DockerContainerCPUCapacityPercent(container, host.CPUs), now)m.metricsStore.Write("dockerContainer", container.ID, "memory", container.MemoryPercent, now)m.metricsStore.Write("dockerContainer", container.ID, "disk", diskPercent, now)if container.NetInRate >= 0 {diff --git a/internal/monitoring/monitor_docker_test.go b/internal/monitoring/monitor_docker_test.goindex e06ffa4fee..fbde2e27fe 100644--- a/internal/monitoring/monitor_docker_test.go+++ b/internal/monitoring/monitor_docker_test.go@@ -336,6 +336,45 @@ func TestApplyDockerReportIncludesContainerDiskDetails(t *testing.T) {}}+func TestApplyDockerReportNormalizesContainerCPUCapacity(t *testing.T) {+ report := agentsdocker.Report{+ Agent: agentsdocker.AgentInfo{+ ID: "agent-1",+ Version: "1.2.3",+ IntervalSeconds: 30,+ },+ Host: agentsdocker.HostInfo{+ Hostname: "cpu-host",+ TotalCPU: 4,+ },+ Containers: []agentsdocker.Container{{+ ID: "ctr-1",+ Name: "transcoder",+ State: "running",+ Status: "running",+ CPUPercent: 240,+ }},+ Timestamp: time.Now().UTC(),+ }++ monitor := newTestMonitor(t)+ host, err := monitor.ApplyDockerReport(report, nil)+ if err != nil {+ t.Fatalf("ApplyDockerReport returned error: %v", err)+ }++ if len(host.Containers) != 1 {+ t.Fatalf("expected 1 container, got %d", len(host.Containers))+ }+ container := host.Containers[0]+ if container.CPUPercent != 240 {+ t.Fatalf("raw Docker CPU percent = %v, want 240", container.CPUPercent)+ }+ if container.CPUCapacityPercent != 60 {+ t.Fatalf("normalized Docker CPU capacity percent = %v, want 60", container.CPUCapacityPercent)+ }+}+func TestApplyDockerReportMigratesMetadataWhenContainerRuntimeIDChanges(t *testing.T) {monitor := newTestMonitor(t)diff --git a/internal/monitoring/monitor_host_agents_test.go b/internal/monitoring/monitor_host_agents_test.goindex 7dcc373298..bcbb3393be 100644--- a/internal/monitoring/monitor_host_agents_test.go+++ b/internal/monitoring/monitor_host_agents_test.go@@ -211,6 +211,48 @@ func TestFindLinkedProxmoxEntityWithHints_UsesExactEndpointHostnameBeforeNameFal}}+func TestApplyDockerReportNormalizesContainerCPUCapacityAcceptedIngestProof(t *testing.T) {+ monitor := newTestMonitor(t)+ token := &config.APITokenRecord{ID: "token-docker-cpu", Name: "Docker Token"}++ host, err := monitor.ApplyDockerReport(agentsdocker.Report{+ Agent: agentsdocker.AgentInfo{+ ID: "docker-cpu-agent",+ Version: "1.0.0",+ IntervalSeconds: 30,+ },+ Host: agentsdocker.HostInfo{+ Hostname: "docker-cpu-host",+ MachineID: "docker-cpu-machine",+ TotalCPU: 4,+ TotalMemoryBytes: 8 << 30,+ },+ Containers: []agentsdocker.Container{{+ ID: "container-cpu",+ Name: "api",+ Image: "nginx:latest",+ State: "running",+ Status: "Up 1 minute",+ CPUPercent: 240,+ }},+ Timestamp: time.Now().UTC(),+ }, token)+ if err != nil {+ t.Fatalf("ApplyDockerReport: %v", err)+ }+ if len(host.Containers) != 1 {+ t.Fatalf("expected one reported container, got %d", len(host.Containers))+ }+ if got := host.Containers[0].CPUCapacityPercent; got != 60 {+ t.Fatalf("reported container CPU capacity percent = %v, want 60", got)+ }++ points := monitor.metricsHistory.GetGuestMetrics("docker:"+host.Containers[0].ID, "cpu", time.Hour)+ if len(points) != 1 || points[0].Value != 60 {+ t.Fatalf("metrics history Docker CPU points = %+v, want one normalized value 60", points)+ }+}+func TestMonitor_HostAgentConfigUpdatePreservesReportedCommandStateInHostState(t *testing.T) {monitor := &Monitor{state: models.NewState(),diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.goindex 788f48be69..c815017dac 100644--- a/internal/unifiedresources/adapters.go+++ b/internal/unifiedresources/adapters.go@@ -2025,7 +2025,7 @@ func isZFSStorageType(storageType string) bool {}func resourceFromDockerContainer(ct models.DockerContainer, host models.DockerHost) (Resource, ResourceIdentity) {- metrics := metricsFromDockerContainer(ct)+ metrics := metricsFromDockerContainer(ct, host.CPUs)now := time.Now().UTC()runtime := strings.TrimSpace(host.Runtime)if runtime == "" {@@ -2036,22 +2036,25 @@ func resourceFromDockerContainer(ct models.DockerContainer, host models.DockerHo}}docker := &DockerData{- HostSourceID: host.ID,- AgentID: strings.TrimSpace(host.AgentID),- ContainerID: ct.ID,- Hostname: host.Hostname,- Image: ct.Image,- ImageID: ct.ImageDigest,- UptimeSeconds: ct.UptimeSeconds,- ContainerState: ct.State,- Health: ct.Health,- RestartCount: ct.RestartCount,- ExitCode: ct.ExitCode,- Labels: cloneLabelMap(ct.Labels),- Runtime: runtime,- RuntimeVersion: host.RuntimeVersion,- DockerVersion: host.DockerVersion,- Security: cloneDockerHostSecurity(host.Security),+ HostSourceID: host.ID,+ AgentID: strings.TrimSpace(host.AgentID),+ ContainerID: ct.ID,+ Hostname: host.Hostname,+ Image: ct.Image,+ ImageID: ct.ImageDigest,+ UptimeSeconds: ct.UptimeSeconds,+ ContainerState: ct.State,+ Health: ct.Health,+ RestartCount: ct.RestartCount,+ ExitCode: ct.ExitCode,+ CPURawPercent: ct.CPUPercent,+ CPUCapacityPercent: models.DockerContainerCPUCapacityPercent(ct, host.CPUs),+ CPUCapacityCores: host.CPUs,+ Labels: cloneLabelMap(ct.Labels),+ Runtime: runtime,+ RuntimeVersion: host.RuntimeVersion,+ DockerVersion: host.DockerVersion,+ Security: cloneDockerHostSecurity(host.Security),}if !ct.CreatedAt.IsZero() {docker.CreatedAt = ct.CreatedAt.UTC().Format(time.RFC3339)diff --git a/internal/unifiedresources/adapters_test.go b/internal/unifiedresources/adapters_test.goindex 18713a767a..b50616ee2f 100644--- a/internal/unifiedresources/adapters_test.go+++ b/internal/unifiedresources/adapters_test.go@@ -107,6 +107,35 @@ func TestResourceFromDockerContainerAdvertisesLifecycleCapabilities(t *testing.T}}+func TestResourceFromDockerContainerNormalizesDockerCPUCapacity(t *testing.T) {+ resource, _ := resourceFromDockerContainer(models.DockerContainer{+ ID: "abc123",+ Name: "transcoder",+ State: "running",+ CPUPercent: 240,+ }, models.DockerHost{+ ID: "docker-host-1",+ Hostname: "dock1",+ CPUs: 4,+ })++ if resource.Metrics == nil || resource.Metrics.CPU == nil {+ t.Fatalf("expected CPU metric on Docker container resource: %+v", resource.Metrics)+ }+ if got := resource.Metrics.CPU.Percent; got != 60 {+ t.Fatalf("Docker container CPU metric percent = %v, want host-capacity-normalized 60", got)+ }+ if resource.Docker == nil {+ t.Fatal("expected Docker metadata")+ }+ if resource.Docker.CPURawPercent != 240 {+ t.Fatalf("Docker raw CPU percent = %v, want 240", resource.Docker.CPURawPercent)+ }+ if resource.Docker.CPUCapacityPercent != 60 || resource.Docker.CPUCapacityCores != 4 {+ t.Fatalf("Docker capacity CPU metadata = %v across %d cores, want 60 across 4", resource.Docker.CPUCapacityPercent, resource.Docker.CPUCapacityCores)+ }+}+func TestResourceFromDockerContainerLifecycleCapabilitiesFailClosed(t *testing.T) {now := time.Now().UTC()baseHost := models.DockerHost{diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.goindex 100ed0b957..ee1c7962cd 100644--- a/internal/unifiedresources/code_standards_test.go+++ b/internal/unifiedresources/code_standards_test.go@@ -249,6 +249,30 @@ func TestCloneResourceClonesDockerSecurityPosture(t *testing.T) {}}+func TestCloneResourcePreservesDockerCPUCapacityMetadata(t *testing.T) {+ original := Resource{+ ID: "app-container:docker-host-1:web",+ Type: ResourceTypeAppContainer,+ Docker: &DockerData{+ HostSourceID: "docker-host-1",+ ContainerID: "web",+ CPURawPercent: 240,+ CPUCapacityPercent: 60,+ CPUCapacityCores: 4,+ },+ }++ cloned := cloneResource(&original)+ if cloned.Docker == nil {+ t.Fatal("clone lost Docker metadata")+ }+ if cloned.Docker.CPURawPercent != 240 ||+ cloned.Docker.CPUCapacityPercent != 60 ||+ cloned.Docker.CPUCapacityCores != 4 {+ t.Fatalf("docker CPU capacity metadata clone = %+v, want raw 240 normalized 60 cores 4", cloned.Docker)+ }+}+func TestCloneResourceCopiesHostThermalState(t *testing.T) {warningLevel := 1resource := Resource{diff --git a/internal/unifiedresources/metrics.go b/internal/unifiedresources/metrics.goindex 127c3f7f87..718c132a79 100644--- a/internal/unifiedresources/metrics.go+++ b/internal/unifiedresources/metrics.go@@ -255,9 +255,13 @@ func metricsFromPhysicalDisk(disk models.PhysicalDisk) *ResourceMetrics {return metrics}-func metricsFromDockerContainer(ct models.DockerContainer) *ResourceMetrics {+func metricsFromDockerContainer(ct models.DockerContainer, hostCPUs ...int) *ResourceMetrics {metrics := &ResourceMetrics{}- cpuPercent := percentFromUsage(ct.CPUPercent)+ cpuCapacity := 0+ if len(hostCPUs) > 0 {+ cpuCapacity = hostCPUs[0]+ }+ cpuPercent := percentFromUsage(models.DockerContainerCPUCapacityPercent(ct, cpuCapacity))metrics.CPU = &MetricValue{Value: cpuPercent, Percent: cpuPercent, Unit: "percent", Source: SourceDocker}if ct.MemoryLimit > 0 {percent := percentFromUsage(ct.MemoryPercent)diff --git a/internal/unifiedresources/metrics_test.go b/internal/unifiedresources/metrics_test.goindex 4b6188d22f..b247a5bc86 100644--- a/internal/unifiedresources/metrics_test.go+++ b/internal/unifiedresources/metrics_test.go@@ -235,6 +235,23 @@ func TestMetricsFromDockerContainerIncludesContainerIORates(t *testing.T) {}}+func TestMetricsFromDockerContainerUsesHostCapacityNormalizedCPU(t *testing.T) {+ container := models.DockerContainer{+ ID: "ctr-cpu-1",+ Name: "api",+ State: "running",+ CPUPercent: 240,+ }++ metrics := metricsFromDockerContainer(container, 4)+ if metrics.CPU == nil {+ t.Fatal("expected Docker container CPU metric")+ }+ if metrics.CPU.Value != 60 || metrics.CPU.Percent != 60 {+ t.Fatalf("Docker container CPU metric = value %v percent %v, want 60", metrics.CPU.Value, metrics.CPU.Percent)+ }+}+func TestMetricsFromDockerContainerMockFallbackSynthesizesIO(t *testing.T) {enableMockMode(t)diff --git a/internal/unifiedresources/types.go b/internal/unifiedresources/types.goindex c5016cf9a7..b04461cd59 100644--- a/internal/unifiedresources/types.go+++ b/internal/unifiedresources/types.go@@ -954,19 +954,22 @@ type DockerData struct {Security *models.DockerHostSecurity `json:"security,omitempty"`// Container-specific fields (populated when Resource.Type == ResourceTypeAppContainer)- ContainerState string `json:"containerState,omitempty"`- Health string `json:"health,omitempty"`- RestartCount int `json:"restartCount,omitempty"`- ExitCode int `json:"exitCode,omitempty"`- StartedAt *time.Time `json:"startedAt,omitempty"`- FinishedAt *time.Time `json:"finishedAt,omitempty"`- BlockIO *DockerContainerBlockIOMeta `json:"blockIo,omitempty"`- Podman *DockerPodmanContainerMeta `json:"podman,omitempty"`- Ports []DockerPortMeta `json:"ports,omitempty"`- Labels map[string]string `json:"labels,omitempty"`- Networks []DockerNetworkMeta `json:"networks,omitempty"`- Mounts []DockerMountMeta `json:"mounts,omitempty"`- UpdateStatus *DockerUpdateStatusMeta `json:"updateStatus,omitempty"`+ ContainerState string `json:"containerState,omitempty"`+ Health string `json:"health,omitempty"`+ RestartCount int `json:"restartCount,omitempty"`+ ExitCode int `json:"exitCode,omitempty"`+ CPURawPercent float64 `json:"cpuRawPercent,omitempty"`+ CPUCapacityPercent float64 `json:"cpuCapacityPercent,omitempty"`+ CPUCapacityCores int `json:"cpuCapacityCores,omitempty"`+ StartedAt *time.Time `json:"startedAt,omitempty"`+ FinishedAt *time.Time `json:"finishedAt,omitempty"`+ BlockIO *DockerContainerBlockIOMeta `json:"blockIo,omitempty"`+ Podman *DockerPodmanContainerMeta `json:"podman,omitempty"`+ Ports []DockerPortMeta `json:"ports,omitempty"`+ Labels map[string]string `json:"labels,omitempty"`+ Networks []DockerNetworkMeta `json:"networks,omitempty"`+ Mounts []DockerMountMeta `json:"mounts,omitempty"`+ UpdateStatus *DockerUpdateStatusMeta `json:"updateStatus,omitempty"`// Service-specific fields (populated when Resource.Type == ResourceTypeDockerService)ServiceID string `json:"serviceId,omitempty"`diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.pyindex 28b7782bb1..893636ec78 100644--- a/scripts/release_control/subsystem_lookup_test.py+++ b/scripts/release_control/subsystem_lookup_test.py@@ -2917,7 +2917,7 @@ class SubsystemLookupTest(unittest.TestCase):{"heading": "## Shared Boundaries","path": "internal/api/access_control_handlers.go",- "line": 1152,+ "line": 1159,"heading_line": 137,}],