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
Surface LXC Docker hosts with real metrics and an LXC badge
rcourtman56d5ffca0af5
diff --git a/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts b/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.tsindex 724bedee87..6e174194c4 100644--- a/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts@@ -377,6 +377,40 @@ describe('resourceBadgePresentation', () => {expect(getInfrastructureSystemIdentitySortLabel(resource)).toBe('PVE');});+ it('renders Proxmox LXC Docker hosts with an LXC badge derived from the host source id', () => {+ const lxcDockerHost = makeResource({+ type: 'docker-host',+ platformType: 'docker',+ sourceType: 'agent',+ docker: {+ hostSourceId: 'proxmox-lxc-docker:pve-a:node-a:141',+ hostname: 'homepage-docker',+ runtime: 'docker',+ },+ } as Partial<Resource>);++ const badges = getInfrastructureSystemIdentityBadges(lxcDockerHost);+ expect(badges.map((b) => b.label)).toEqual(['LXC 141']);+ expect(badges[0]?.title).toBe('Docker running inside Proxmox LXC 141');+ });++ it('falls back to a bare LXC badge when the VMID cannot be parsed from the host source id', () => {+ const lxcDockerHost = makeResource({+ type: 'docker-host',+ platformType: 'docker',+ sourceType: 'agent',+ docker: {+ hostSourceId: 'proxmox-lxc-docker:custom-non-numeric-id',+ hostname: 'something',+ runtime: 'docker',+ },+ } as Partial<Resource>);++ expect(getInfrastructureSystemIdentityBadges(lxcDockerHost).map((b) => b.label)).toEqual([+ 'LXC',+ ]);+ });+it('uses probe protocol identity for agentless network endpoints', () => {const resource = makeResource({type: 'network-endpoint',diff --git a/frontend-modern/src/utils/resourceBadgePresentation.ts b/frontend-modern/src/utils/resourceBadgePresentation.tsindex 0e3f793966..d74f2e8643 100644--- a/frontend-modern/src/utils/resourceBadgePresentation.ts+++ b/frontend-modern/src/utils/resourceBadgePresentation.ts@@ -560,7 +560,39 @@ const getStorageSystemIdentityBadge = ();};+const LXC_DOCKER_HOST_PREFIX = 'proxmox-lxc-docker:';++const proxmoxLxcDockerVmid = (resource: Resource): number | null => {+ const sourceId = resource.docker?.hostSourceId;+ if (typeof sourceId !== 'string' || !sourceId.startsWith(LXC_DOCKER_HOST_PREFIX)) {+ return null;+ }+ const tail = sourceId.slice(LXC_DOCKER_HOST_PREFIX.length);+ const lastSegment = tail.split(':').pop() ?? '';+ const parsed = Number(lastSegment);+ return Number.isInteger(parsed) && parsed > 0 ? parsed : null;+};++const proxmoxLxcDockerBadge = (resource: Resource): ResourceBadge | null => {+ if (typeof resource.docker?.hostSourceId !== 'string') return null;+ if (!resource.docker.hostSourceId.startsWith(LXC_DOCKER_HOST_PREFIX)) return null;+ const vmid = proxmoxLxcDockerVmid(resource);+ const label = vmid !== null ? `LXC ${vmid}` : 'LXC';+ return {+ label,+ classes: `${baseBadge} bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300`,+ title: vmid !== null+ ? `Docker running inside Proxmox LXC ${vmid}`+ : 'Docker running inside a Proxmox LXC',+ };+};+export function getInfrastructureSystemIdentityBadges(resource: Resource): ResourceBadge[] {+ const lxcDockerBadge = proxmoxLxcDockerBadge(resource);+ if (lxcDockerBadge) {+ return [lxcDockerBadge];+ }+const platformData = getPlatformDataRecord(resource) as| (Record<string, unknown> & { sources?: string[] })| undefined;diff --git a/internal/monitoring/docker_detection.go b/internal/monitoring/docker_detection.goindex a02f6e525f..24a6bb1cd5 100644--- a/internal/monitoring/docker_detection.go+++ b/internal/monitoring/docker_detection.go@@ -300,6 +300,8 @@ func (m *Monitor) CollectProxmoxGuestDockerInventory(ctx context.Context, contaireturn}+ enrichGuestDockerReportFromContainer(&report, container)+if _, err := m.ApplyDockerReport(report, nil); err != nil {log.Warn().Err(err).@@ -611,13 +613,54 @@ func proxmoxGuestDockerAgentID(container models.Container) string {func proxmoxGuestDockerDisplayName(container models.Container) string {name := strings.TrimSpace(container.Name)- if name == "" {- name = fmt.Sprintf("LXC %d", container.VMID)+ if name != "" {+ return name+ }+ return fmt.Sprintf("LXC %d", container.VMID)+}++// enrichGuestDockerReportFromContainer copies CPU / memory / disk telemetry+// from the underlying Proxmox LXC into the Docker host info before the report+// is applied. The Docker inventory script collects only sizing metadata+// (CPU count, MEMTOTAL); the LXC's live resource usage is already polled via+// the PVE cluster/resources endpoint, so the Docker host row should show+// what the rest of Pulse already knows about that guest. Only zero-valued+// fields are populated so values reported by the inventory script itself+// (when present in future revisions) still take precedence.+func enrichGuestDockerReportFromContainer(report *agentsdocker.Report, container models.Container) {+ if report == nil {+ return+ }+ if report.Host.CPUUsagePercent == 0 && container.CPU > 0 {+ report.Host.CPUUsagePercent = container.CPU * 100+ }+ if report.Host.Memory.TotalBytes == 0 && container.Memory.Total > 0 {+ report.Host.Memory.TotalBytes = container.Memory.Total+ }+ if report.Host.Memory.UsedBytes == 0 && container.Memory.Used > 0 {+ report.Host.Memory.UsedBytes = container.Memory.Used+ }+ if report.Host.Memory.FreeBytes == 0 && container.Memory.Free > 0 {+ report.Host.Memory.FreeBytes = container.Memory.Free+ }+ if report.Host.Memory.Usage == 0 && container.Memory.Usage > 0 {+ report.Host.Memory.Usage = container.Memory.Usage+ }+ if report.Host.TotalMemoryBytes == 0 && container.Memory.Total > 0 {+ report.Host.TotalMemoryBytes = container.Memory.Total+ }+ if len(report.Host.Disks) == 0 && container.Disk.Total > 0 {+ report.Host.Disks = []agentsdocker.Disk{{+ Mountpoint: "/",+ TotalBytes: container.Disk.Total,+ UsedBytes: container.Disk.Used,+ FreeBytes: container.Disk.Free,+ Usage: container.Disk.Usage,+ }}}- if container.VMID > 0 {- return fmt.Sprintf("%s (LXC %d)", name, container.VMID)+ if report.Host.UptimeSeconds == 0 && container.Uptime > 0 {+ report.Host.UptimeSeconds = container.Uptime}- return name}func applyUnameToDockerHostInfo(uname string, host *agentsdocker.HostInfo) {diff --git a/internal/monitoring/docker_detection_test.go b/internal/monitoring/docker_detection_test.goindex f69f0c305b..791dfa5af9 100644--- a/internal/monitoring/docker_detection_test.go+++ b/internal/monitoring/docker_detection_test.go@@ -365,7 +365,7 @@ func TestAgentDockerInventoryCollector_MinimalCommandAndReport(t *testing.T) {if report.Host.Hostname != "ct-web" {t.Fatalf("Host.Hostname = %q", report.Host.Hostname)}- if report.Host.Name != "web-lxc (LXC 101)" {+ if report.Host.Name != "web-lxc" {t.Fatalf("Host.Name = %q", report.Host.Name)}if report.Host.DockerVersion != "26.1.4" || report.Host.TotalCPU != 2 || report.Host.TotalMemoryBytes != 1073741824 {@@ -455,6 +455,66 @@ func TestAgentDockerInventoryCollector_PSOKWithZeroContainersApplies(t *testing.}}+func TestEnrichGuestDockerReportFromContainer_FillsMissingHostMetrics(t *testing.T) {+ report := agentsdocker.Report{+ Host: agentsdocker.HostInfo{+ Hostname: "web-lxc",+ TotalCPU: 4,+ TotalMemoryBytes: 4 * 1024 * 1024 * 1024,+ },+ }+ container := models.Container{+ VMID: 141,+ Name: "homepage-docker",+ CPU: 0.42,+ Uptime: 86400,+ Memory: models.Memory{Total: 4 * 1024 * 1024 * 1024, Used: 1 * 1024 * 1024 * 1024, Free: 3 * 1024 * 1024 * 1024, Usage: 25},+ Disk: models.Disk{Total: 8 * 1024 * 1024 * 1024, Used: 2 * 1024 * 1024 * 1024, Free: 6 * 1024 * 1024 * 1024, Usage: 25},+ }++ enrichGuestDockerReportFromContainer(&report, container)++ if report.Host.CPUUsagePercent != 42 {+ t.Fatalf("CPUUsagePercent = %v, want 42", report.Host.CPUUsagePercent)+ }+ if report.Host.Memory.UsedBytes != 1*1024*1024*1024 || report.Host.Memory.TotalBytes != 4*1024*1024*1024 || report.Host.Memory.Usage != 25 {+ t.Fatalf("Memory enrichment failed: %#v", report.Host.Memory)+ }+ if len(report.Host.Disks) != 1 || report.Host.Disks[0].Mountpoint != "/" || report.Host.Disks[0].UsedBytes != 2*1024*1024*1024 {+ t.Fatalf("Disks enrichment failed: %#v", report.Host.Disks)+ }+ if report.Host.UptimeSeconds != 86400 {+ t.Fatalf("UptimeSeconds = %d, want 86400", report.Host.UptimeSeconds)+ }+}++func TestEnrichGuestDockerReportFromContainer_DoesNotOverrideReportedValues(t *testing.T) {+ report := agentsdocker.Report{+ Host: agentsdocker.HostInfo{+ CPUUsagePercent: 7,+ Memory: agentsdocker.MemoryMetric{TotalBytes: 1, UsedBytes: 1, Usage: 99},+ Disks: []agentsdocker.Disk{{Mountpoint: "/data", TotalBytes: 1}},+ },+ }+ container := models.Container{+ CPU: 0.5,+ Memory: models.Memory{Total: 1000, Used: 500, Usage: 50},+ Disk: models.Disk{Total: 1000, Used: 500, Usage: 50},+ }++ enrichGuestDockerReportFromContainer(&report, container)++ if report.Host.CPUUsagePercent != 7 {+ t.Fatalf("CPUUsagePercent overwritten: %v", report.Host.CPUUsagePercent)+ }+ if report.Host.Memory.UsedBytes != 1 || report.Host.Memory.Usage != 99 {+ t.Fatalf("Memory overwritten: %#v", report.Host.Memory)+ }+ if len(report.Host.Disks) != 1 || report.Host.Disks[0].Mountpoint != "/data" {+ t.Fatalf("Disks overwritten: %#v", report.Host.Disks)+ }+}+func TestAgentDockerInventoryCollector_AllowlistSkipsUnlistedVMID(t *testing.T) {called := falsecollector := NewAgentDockerInventoryCollector(func(ctx context.Context, hostname string, command string, timeout int) (string, int, error) {@@ -498,7 +558,7 @@ func TestMonitorCollectProxmoxGuestDockerInventory_AppliesDockerReport(t *testinAgent: agentsdocker.AgentInfo{ID: "proxmox-lxc-docker:pve-a:node-a:101", Type: "unified", IntervalSeconds: 30},Host: agentsdocker.HostInfo{Hostname: "ct-web",- Name: "web-lxc (LXC 101)",+ Name: "web-lxc",Runtime: "docker",DockerVersion: "26.1.4",RuntimeVersion: "26.1.4",