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.

Warn when two machines share one Docker agent identity

rcourtman72c409743d9a
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 8e10a73619..56ab2b704a 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -381,6 +381,14 @@ canonical `agent` resource type. Kubernetes is cluster-agent-backed: canonical
rows, so the unified-resource owner must project the cluster agent identity and
cluster-scoped agent version onto those node rows before the shared stale-agent
collector can decide whether the node inventory is gated by an older agent.
+The Docker duplicate-identity warning follows the same shared notice boundary:
+it composes `InlineNotice`, is driven only by server-authored
+`DockerData.identityConflict` evidence (never by page-local hostname
+comparison), and names the flapping hostnames with the machine-id remedy in
+the notice copy because the fix happens on the operator's machines, not on a
+Pulse settings surface, so it carries no action link. Unlike stale-agent cues
+it is a data-reliability warning and is not gated on the read-only
+presentation policy.
Global dismissible notice bars are also part of the shared `InlineNotice`
boundary. `frontend-modern/src/components/DemoBanner.tsx` and
`frontend-modern/src/components/CommercialMigrationBanner.tsx` must compose
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index fba6502ba5..8018a5715e 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -69,6 +69,20 @@ models, and unified resources. An absent value means an older or reduced-fidelit
report did not provide the evidence and must remain distinguishable from both
confirmed OOM and confirmed non-OOM state. Exit code 137 proves only SIGKILL and
must not be promoted into OOM truth by monitoring.
+Docker host identity collapse must be surfaced, not silently absorbed. Docker
+report ingest keys host identity on the agent-reported machine ID in unified
+mode, so cloned VMs that still share `/etc/machine-id` fold into one
+`models.DockerHost` whose reports alternately overwrite each other (#1584).
+Ingest must watch each resolved host identity for identity-field revisits: a
+reported hostname (or machine ID) that switches away and returns to a value
+already observed inside the monitoring-owned flap window proves two machines
+share the identity, while a one-time hostname rename never revisits and must
+not be flagged. An active conflict is published as
+`models.DockerHost.IdentityConflict` carrying the flapping values so
+downstream surfaces can warn, and it must clear on its own once only one
+machine keeps reporting for the window. Monitoring must not auto-split the
+collapsed identity: the machine ID is the identity key, and the remedy
+(regenerating the clone's machine-id) belongs to the operator.
Proxmox read-state rehydration is the inverse boundary: canonical
unified-resource CPU metrics are 0..100 percentages, while legacy
`models.Node.CPU`, `models.VM.CPU`, and `models.Container.CPU` remain Proxmox
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 8316c18ab8..3cd40759e2 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -120,6 +120,12 @@ Storage and recovery consumers may preserve and display it as runtime workload
context, but must not reinterpret confirmed OOM, confirmed non-OOM, missing
evidence, or exit code 137 as backup damage, protection health, restore
readiness, or a recovery-point signal.
+It also applies to monitoring-authored `DockerData.IdentityConflict`
+duplicate-identity evidence: storage and recovery consumers may surface it as
+runtime workload context explaining unreliable host rows, but must not
+reinterpret cloned-machine identity flapping as backup coverage gaps,
+protection drift, restore readiness, or a recovery-point signal, and must not
+mint additional storage or recovery rows for the flapping hostnames.
Local subscription-agent settings in `internal/api/ai_handlers.go` remain an
ai-runtime transport choice even when Patrol observes storage or recovery
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 5e018a17df..48a8e788e2 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -534,6 +534,15 @@ code 137 into a positive classification; typed Docker views must return an
independent copy of that value. Frontend detail summaries and
Docker page search consume those backend-authored fields before falling back to
legacy labels.
+Docker host duplicate-identity evidence is monitoring-authored and rides
+`DockerData.IdentityConflict` unchanged: the adapter, resource clone, and
+typed `DockerHostView` accessor must each hand out an independent copy so
+concurrent snapshot replacement cannot alias the conflict's hostname and
+machine-ID lists, and read-state reconstruction back to `models.DockerHost`
+must preserve the field rather than dropping it. Consumers render the
+conflict as a warning about cloned machines sharing `/etc/machine-id`; they
+must not reinterpret it as staleness, or synthesize a second host row from
+the flapping values.
Docker network rows must consume canonical runtime attachment relationships,
not page-local topology inference, when the unified-resource snapshot provides
them. Runtime container-to-network membership is represented as active
diff --git a/frontend-modern/src/features/docker/DockerIdentityConflictNotice.tsx b/frontend-modern/src/features/docker/DockerIdentityConflictNotice.tsx
new file mode 100644
index 0000000000..734b0073e2
--- /dev/null
+++ b/frontend-modern/src/features/docker/DockerIdentityConflictNotice.tsx
@@ -0,0 +1,52 @@
+import { Show, createMemo } from 'solid-js';
+import { AlertTriangle } from 'lucide-solid';
+import { InlineNotice } from '@/components/shared/InlineNotice';
+import type { IdentityConflictHost } from './dockerIdentityConflict';
+
+type DockerIdentityConflictNoticeProps = {
+ hosts: IdentityConflictHost[];
+};
+
+const hostLabel = (host: IdentityConflictHost): string =>
+ host.hostnames.length > 1 ? `${host.name} (${host.hostnames.join(', ')})` : host.name;
+
+// Warns when the server detects reports from two different machines being
+// folded into one Docker host record, usually cloned VMs that still share the
+// same /etc/machine-id. Unlike the outdated-agent notice this is not gated on
+// presentation policy, because it flags that the data on this page is
+// unreliable, which matters to read-only viewers too.
+export function DockerIdentityConflictNotice(props: DockerIdentityConflictNoticeProps) {
+ const count = createMemo(() => props.hosts.length);
+
+ const message = createMemo(() => {
+ if (count() === 1) {
+ const host = props.hosts[0];
+ const names =
+ host.hostnames.length > 1 ? ` (${host.hostnames.join(', ')})` : '';
+ return (
+ `Two machines appear to share the identity of ${host.name}${names}. ` +
+ `They are likely cloned VMs with the same /etc/machine-id, so Pulse sees them as one host and their reports overwrite each other. ` +
+ `Give one of them a fresh machine-id and restart its agent to monitor them separately.`
+ );
+ }
+ const labels = props.hosts.map(hostLabel).join('; ');
+ return (
+ `${count()} hosts are each receiving reports from more than one machine. ` +
+ `They are likely cloned VMs with the same /etc/machine-id, so their reports overwrite each other. ` +
+ `Give the clones fresh machine-ids and restart their agents to monitor them separately. Affected hosts are ${labels}.`
+ );
+ });
+
+ return (
+ <Show when={count() > 0}>
+ <InlineNotice
+ role="status"
+ data-testid="docker-identity-conflict-notice"
+ tone="warning"
+ icon={<AlertTriangle aria-hidden="true" />}
+ >
+ {message()}
+ </InlineNotice>
+ </Show>
+ );
+}
diff --git a/frontend-modern/src/features/docker/DockerPageSurface.tsx b/frontend-modern/src/features/docker/DockerPageSurface.tsx
index 227e870885..f1d1a9cbed 100644
--- a/frontend-modern/src/features/docker/DockerPageSurface.tsx
+++ b/frontend-modern/src/features/docker/DockerPageSurface.tsx
@@ -41,6 +41,8 @@ import {
formatAgentVersionDisplay,
} from '@/features/platformPage/agentVersion';
import { PlatformOutdatedAgentNotice } from '@/features/platformPage/PlatformOutdatedAgentNotice';
+import { collectIdentityConflictHosts } from './dockerIdentityConflict';
+import { DockerIdentityConflictNotice } from './DockerIdentityConflictNotice';
import { updateStore } from '@/stores/updates';
import {
buildInfrastructureAgentUpdatesPath,
@@ -83,6 +85,7 @@ export function DockerPageSurface() {
const outdatedAgentHosts = createMemo(() =>
collectOutdatedAgentHosts(model().hosts, agentUpdateTargetVersion()),
);
+ const identityConflictHosts = createMemo(() => collectIdentityConflictHosts(model().hosts));
const outdatedAgentUpdatePath = createMemo(() =>
buildInfrastructureAgentUpdatesPath(outdatedAgentHosts().map((host) => host.agentId)),
);
@@ -141,6 +144,7 @@ export function DockerPageSurface() {
/>
}
>
+ <DockerIdentityConflictNotice hosts={identityConflictHosts()} />
<PlatformOutdatedAgentNotice
hosts={outdatedAgentHosts()}
targetVersion={serverVersionDisplay()}
diff --git a/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
index a8ed3f04ea..973eb09440 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
@@ -354,6 +354,36 @@ describe('DockerPageSurface', () => {
);
});
+ it('warns when a host carries server-authored duplicate-identity evidence', () => {
+ mocks.useUnifiedResources.mockReturnValue({
+ error: () => null,
+ loading: () => false,
+ refetch: vi.fn(),
+ resources: () => [
+ makeDockerHost({
+ name: 'clone-a',
+ docker: {
+ runtime: 'docker',
+ identityConflict: { hostnames: ['clone-a', 'clone-b'] },
+ } as NonNullable<Resource['docker']>,
+ }),
+ ],
+ });
+
+ render(() => <DockerPageSurface />);
+
+ const notice = screen.getByTestId('docker-identity-conflict-notice');
+ expect(notice).toHaveTextContent('Two machines appear to share the identity of clone-a');
+ expect(notice).toHaveTextContent('clone-a, clone-b');
+ expect(notice).toHaveTextContent('/etc/machine-id');
+ });
+
+ it('does not warn about identity conflicts on healthy hosts', () => {
+ render(() => <DockerPageSurface />);
+
+ expect(screen.queryByTestId('docker-identity-conflict-notice')).toBeNull();
+ });
+
it('shows Docker object tabs only when the matching inventory exists', () => {
mocks.useUnifiedResources.mockReturnValue({
error: () => null,
diff --git a/frontend-modern/src/features/docker/__tests__/dockerIdentityConflict.test.tsx b/frontend-modern/src/features/docker/__tests__/dockerIdentityConflict.test.tsx
new file mode 100644
index 0000000000..ee9f54c7d2
--- /dev/null
+++ b/frontend-modern/src/features/docker/__tests__/dockerIdentityConflict.test.tsx
@@ -0,0 +1,83 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it } from 'vitest';
+
+import type { Resource } from '@/types/resource';
+import { collectIdentityConflictHosts } from '../dockerIdentityConflict';
+import { DockerIdentityConflictNotice } from '../DockerIdentityConflictNotice';
+
+const dockerHost = (overrides: Partial<Resource> = {}): Resource =>
+ ({
+ id: 'docker-host-1',
+ type: 'docker-host',
+ name: 'docker-host-1',
+ ...overrides,
+ }) as Resource;
+
+describe('collectIdentityConflictHosts', () => {
+ it('returns an empty list when no host carries a conflict', () => {
+ expect(collectIdentityConflictHosts([dockerHost(), dockerHost({ id: 'h2', name: 'h2' })])).toEqual(
+ [],
+ );
+ });
+
+ it('collects conflicting hosts with their hostnames', () => {
+ const hosts = [
+ dockerHost({
+ docker: {
+ identityConflict: {
+ hostnames: ['clone-a', ' clone-b '],
+ firstSeen: '2026-07-16T12:00:00Z',
+ lastSeen: '2026-07-16T12:05:00Z',
+ },
+ },
+ }),
+ dockerHost({ id: 'healthy', name: 'healthy' }),
+ ];
+ expect(collectIdentityConflictHosts(hosts)).toEqual([
+ { name: 'docker-host-1', hostnames: ['clone-a', 'clone-b'] },
+ ]);
+ });
+
+ it('falls back to the resource id when the name is missing', () => {
+ const hosts = [
+ dockerHost({ name: '', docker: { identityConflict: { hostnames: ['a', 'b'] } } }),
+ ];
+ expect(collectIdentityConflictHosts(hosts)[0].name).toBe('docker-host-1');
+ });
+});
+
+describe('DockerIdentityConflictNotice', () => {
+ afterEach(() => cleanup());
+
+ it('renders nothing without conflicts', () => {
+ render(() => <DockerIdentityConflictNotice hosts={[]} />);
+ expect(screen.queryByTestId('docker-identity-conflict-notice')).toBeNull();
+ });
+
+ it('explains a single conflicted host with its flapping hostnames', () => {
+ render(() => (
+ <DockerIdentityConflictNotice
+ hosts={[{ name: 'docker-host-1', hostnames: ['clone-a', 'clone-b'] }]}
+ />
+ ));
+ const notice = screen.getByTestId('docker-identity-conflict-notice');
+ expect(notice.textContent).toContain('Two machines appear to share the identity of docker-host-1');
+ expect(notice.textContent).toContain('clone-a, clone-b');
+ expect(notice.textContent).toContain('/etc/machine-id');
+ });
+
+ it('lists every affected host when several conflict', () => {
+ render(() => (
+ <DockerIdentityConflictNotice
+ hosts={[
+ { name: 'host-1', hostnames: ['a', 'b'] },
+ { name: 'host-2', hostnames: ['c', 'd'] },
+ ]}
+ />
+ ));
+ const notice = screen.getByTestId('docker-identity-conflict-notice');
+ expect(notice.textContent).toContain('2 hosts');
+ expect(notice.textContent).toContain('host-1 (a, b)');
+ expect(notice.textContent).toContain('host-2 (c, d)');
+ });
+});
diff --git a/frontend-modern/src/features/docker/dockerIdentityConflict.ts b/frontend-modern/src/features/docker/dockerIdentityConflict.ts
new file mode 100644
index 0000000000..90539fb632
--- /dev/null
+++ b/frontend-modern/src/features/docker/dockerIdentityConflict.ts
@@ -0,0 +1,27 @@
+import type { Resource } from '@/types/resource';
+
+// Duplicate-identity detection for Docker hosts (#1584). The server flags a
+// host when reports from more than one machine are being folded into a single
+// identity, which usually means cloned VMs still sharing /etc/machine-id. The
+// hosts silently overwrite each other in Pulse, so the page needs to say so.
+
+export type IdentityConflictHost = {
+ name: string;
+ hostnames: string[];
+};
+
+export function collectIdentityConflictHosts(hosts: Resource[]): IdentityConflictHost[] {
+ const conflicts: IdentityConflictHost[] = [];
+ for (const host of hosts) {
+ const conflict = host.docker?.identityConflict;
+ if (!conflict) continue;
+ const hostnames = (conflict.hostnames ?? [])
+ .map((hostname) => hostname.trim())
+ .filter((hostname) => hostname.length > 0);
+ conflicts.push({
+ name: host.name?.trim() || host.id || 'host',
+ hostnames,
+ });
+ }
+ return conflicts;
+}
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index ede228a687..466a0ee0c9 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -707,6 +707,14 @@ export interface ResourceDockerMeta {
mutatingCommandsBlocked?: boolean;
mutatingCommandsBlockedReason?: string;
};
+ // Set while the server sees reports from more than one machine folded into
+ // this host identity (usually cloned VMs sharing the same /etc/machine-id).
+ identityConflict?: {
+ hostnames?: string[];
+ machineIds?: string[];
+ firstSeen?: string;
+ lastSeen?: string;
+ };
image?: string;
imageId?: string;
repoTags?: string[];
diff --git a/internal/models/deepcopy.go b/internal/models/deepcopy.go
index 6f86952943..6535ee789c 100644
--- a/internal/models/deepcopy.go
+++ b/internal/models/deepcopy.go
@@ -599,6 +599,16 @@ func cloneDockerHostSecurity(src *DockerHostSecurity) *DockerHostSecurity {
return &dest
}
+func cloneDockerHostIdentityConflict(src *DockerHostIdentityConflict) *DockerHostIdentityConflict {
+ if src == nil {
+ return nil
+ }
+ dest := *src
+ dest.Hostnames = append([]string(nil), src.Hostnames...)
+ dest.MachineIDs = append([]string(nil), src.MachineIDs...)
+ return &dest
+}
+
func cloneDockerHostCommandStatus(src *DockerHostCommandStatus) *DockerHostCommandStatus {
if src == nil {
return nil
@@ -632,6 +642,7 @@ func cloneDockerHost(src DockerHost) DockerHost {
dest.Temperature = cloneFloat64Ptr(src.Temperature)
dest.TokenLastUsedAt = cloneTimePtr(src.TokenLastUsedAt)
dest.Command = cloneDockerHostCommandStatus(src.Command)
+ dest.IdentityConflict = cloneDockerHostIdentityConflict(src.IdentityConflict)
return dest.NormalizeCollections()
}
diff --git a/internal/models/deepcopy_test.go b/internal/models/deepcopy_test.go
index bfe17fc569..44b1b4f368 100644
--- a/internal/models/deepcopy_test.go
+++ b/internal/models/deepcopy_test.go
@@ -38,6 +38,33 @@ func TestCloneDockerContainer_PreservesIndependentOOMEvidence(t *testing.T) {
}
}
+func TestCloneDockerHost_PreservesIndependentIdentityConflict(t *testing.T) {
+ src := DockerHost{
+ ID: "docker-host-1",
+ IdentityConflict: &DockerHostIdentityConflict{
+ Hostnames: []string{"clone-a", "clone-b"},
+ MachineIDs: []string{"machine-a", "machine-b"},
+ },
+ }
+
+ got := cloneDockerHost(src)
+ if got.IdentityConflict == nil {
+ t.Fatal("clone dropped identity conflict evidence")
+ }
+ if len(got.IdentityConflict.Hostnames) != 2 || got.IdentityConflict.Hostnames[0] != "clone-a" {
+ t.Fatalf("hostnames = %v, want [clone-a clone-b]", got.IdentityConflict.Hostnames)
+ }
+ src.IdentityConflict.Hostnames[0] = "mutated"
+ src.IdentityConflict.MachineIDs[0] = "mutated"
+ if got.IdentityConflict.Hostnames[0] != "clone-a" || got.IdentityConflict.MachineIDs[0] != "machine-a" {
+ t.Fatal("cloned Docker host must own its identity conflict slices")
+ }
+
+ if clean := cloneDockerHost(DockerHost{ID: "healthy"}); clean.IdentityConflict != nil {
+ t.Fatalf("healthy host should clone with nil conflict, got %+v", clean.IdentityConflict)
+ }
+}
+
func TestCloneFloat64Ptr_Nil(t *testing.T) {
if cloneFloat64Ptr(nil) != nil {
t.Error("nil should clone to nil")
diff --git a/internal/models/models.go b/internal/models/models.go
index cca8e227c8..15d95464da 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -778,6 +778,10 @@ type DockerHost struct {
PendingUninstall bool `json:"pendingUninstall"`
Command *DockerHostCommandStatus `json:"command,omitempty"`
IsLegacy bool `json:"isLegacy,omitempty"`
+ // IdentityConflict is set while multiple distinct machines appear to be
+ // reporting under this host's identity (e.g. cloned VMs sharing the same
+ // /etc/machine-id). Nil when no conflict is active.
+ IdentityConflict *DockerHostIdentityConflict `json:"identityConflict,omitempty"`
// Computed I/O rates (bytes/sec), populated by monitoring pipeline when available.
NetInRate float64 `json:"netInRate,omitempty"`
@@ -854,9 +858,31 @@ func (h DockerHost) NormalizeCollections() DockerHost {
security := h.Security.NormalizeCollections()
h.Security = &security
}
+ if h.IdentityConflict != nil {
+ conflict := h.IdentityConflict.NormalizeCollections()
+ h.IdentityConflict = &conflict
+ }
return h
}
+// DockerHostIdentityConflict records evidence that reports from more than one
+// physical machine are being folded into a single Docker host record. The
+// usual cause is cloned VMs that still share the same /etc/machine-id, which
+// the agent uses as its identity in unified mode.
+type DockerHostIdentityConflict struct {
+ Hostnames []string `json:"hostnames"`
+ MachineIDs []string `json:"machineIds,omitempty"`
+ FirstSeen time.Time `json:"firstSeen"`
+ LastSeen time.Time `json:"lastSeen"`
+}
+
+func (c DockerHostIdentityConflict) NormalizeCollections() DockerHostIdentityConflict {
+ if c.Hostnames == nil {
+ c.Hostnames = []string{}
+ }
+ return c
+}
+
// DockerHostSecurity describes security-relevant runtime posture for a Docker host.
type DockerHostSecurity struct {
AuthorizationPlugins []string `json:"authorizationPlugins,omitempty"`
diff --git a/internal/monitoring/docker_identity_conflict.go b/internal/monitoring/docker_identity_conflict.go
new file mode 100644
index 0000000000..7e11c6a498
--- /dev/null
+++ b/internal/monitoring/docker_identity_conflict.go
@@ -0,0 +1,138 @@
+package monitoring
+
+import (
+ "sort"
+ "strings"
+ "time"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/models"
+)
+
+// dockerIdentityConflictWindow bounds how far apart two reports can be and
+// still count as evidence that distinct machines share one identity. It also
+// controls how long a detected conflict stays visible after the flapping
+// stops (e.g. one of the clones was fixed or shut down). Sized to cover a few
+// report cycles even for agents on multi-minute intervals.
+const dockerIdentityConflictWindow = 15 * time.Minute
+
+// dockerIdentityFlapTracker watches the stream of reports folded into a single
+// Docker host identity and detects when two distinct machines are behind it.
+//
+// The signal is a *revisit*: the reported hostname (or machine ID) switches
+// away from the previous value and back to one already seen inside the
+// window. A genuine hostname rename transitions exactly once and never
+// revisits the old value, so it does not trip the detector; cloned VMs that
+// share /etc/machine-id alternate every report cycle and trip it immediately.
+type dockerIdentityFlapTracker struct {
+ hostnames map[string]time.Time
+ machineIDs map[string]time.Time
+
+ lastHostname string
+ lastMachineID string
+
+ conflictSince time.Time
+ conflictLastSeen time.Time
+}
+
+func newDockerIdentityFlapTracker() *dockerIdentityFlapTracker {
+ return &dockerIdentityFlapTracker{
+ hostnames: make(map[string]time.Time),
+ machineIDs: make(map[string]time.Time),
+ }
+}
+
+// observe records one report's identity fields and returns the active
+// conflict, or nil when the identity looks healthy.
+func (t *dockerIdentityFlapTracker) observe(hostname, machineID string, now time.Time) *models.DockerHostIdentityConflict {
+ hostname = strings.TrimSpace(hostname)
+ machineID = strings.TrimSpace(machineID)
+
+ pruneOlderThan(t.hostnames, now.Add(-dockerIdentityConflictWindow))
+ pruneOlderThan(t.machineIDs, now.Add(-dockerIdentityConflictWindow))
+
+ revisit := false
+ if hostname != "" {
+ if _, seen := t.hostnames[hostname]; seen && t.lastHostname != "" && t.lastHostname != hostname {
+ revisit = true
+ }
+ t.hostnames[hostname] = now
+ t.lastHostname = hostname
+ }
+ if machineID != "" {
+ if _, seen := t.machineIDs[machineID]; seen && t.lastMachineID != "" && t.lastMachineID != machineID {
+ revisit = true
+ }
+ t.machineIDs[machineID] = now
+ t.lastMachineID = machineID
+ }
+
+ if revisit {
+ if t.conflictSince.IsZero() || now.Sub(t.conflictLastSeen) > dockerIdentityConflictWindow {
+ t.conflictSince = now
+ }
+ t.conflictLastSeen = now
+ }
+
+ if t.conflictLastSeen.IsZero() || now.Sub(t.conflictLastSeen) > dockerIdentityConflictWindow {
+ t.conflictSince = time.Time{}
+ t.conflictLastSeen = time.Time{}
+ return nil
+ }
+
+ conflict := &models.DockerHostIdentityConflict{
+ Hostnames: sortedKeys(t.hostnames),
+ FirstSeen: t.conflictSince,
+ LastSeen: t.conflictLastSeen,
+ }
+ // Machine IDs are only interesting when they themselves diverge; in the
+ // common cloned-VM case there is exactly one shared machine ID and the
+ // hostname list carries the story.
+ if len(t.machineIDs) > 1 {
+ conflict.MachineIDs = sortedKeys(t.machineIDs)
+ }
+ return conflict
+}
+
+func pruneOlderThan(entries map[string]time.Time, cutoff time.Time) {
+ for key, seenAt := range entries {
+ if seenAt.Before(cutoff) {
+ delete(entries, key)
+ }
+ }
+}
+
+func sortedKeys(entries map[string]time.Time) []string {
+ keys := make([]string, 0, len(entries))
+ for key := range entries {
+ keys = append(keys, key)
+ }
+ sort.Strings(keys)
+ return keys
+}
+
+// trackDockerHostIdentity feeds one report's identity fields into the flap
+// tracker for the resolved host identifier and returns the active conflict,
+// if any. Callers must not hold m.mu.
+func (m *Monitor) trackDockerHostIdentity(identifier, hostname, machineID string, now time.Time) *models.DockerHostIdentityConflict {
+ if strings.TrimSpace(identifier) == "" {
+ return nil
+ }
+
+ m.mu.Lock()
+ defer m.mu.Unlock()
+ if m.dockerIdentityFlaps == nil {
+ m.dockerIdentityFlaps = make(map[string]*dockerIdentityFlapTracker)
+ }
+ tracker, ok := m.dockerIdentityFlaps[identifier]
+ if !ok {
+ tracker = newDockerIdentityFlapTracker()
+ m.dockerIdentityFlaps[identifier] = tracker
+ }
+ return tracker.observe(hostname, machineID, now)
+}
+
+// clearDockerHostIdentityTracking drops flap state for a host identity, e.g.
+// when the host is deliberately removed. Callers must hold m.mu.
+func (m *Monitor) clearDockerHostIdentityTrackingLocked(hostID string) {
+ delete(m.dockerIdentityFlaps, hostID)
+}
diff --git a/internal/monitoring/docker_identity_conflict_test.go b/internal/monitoring/docker_identity_conflict_test.go
new file mode 100644
index 0000000000..5865f00488
--- /dev/null
+++ b/internal/monitoring/docker_identity_conflict_test.go
@@ -0,0 +1,200 @@
+package monitoring
+
+import (
+ "testing"
+ "time"
+
+ agentsdocker "github.com/rcourtman/pulse-go-rewrite/pkg/agents/docker"
+)
+
+func TestDockerIdentityFlapTrackerDetectsAlternatingHostnames(t *testing.T) {
+ tracker := newDockerIdentityFlapTracker()
+ base := time.Date(2026, 7, 16, 12, 0, 0, 0, time.UTC)
+ interval := 30 * time.Second
+
+ if conflict := tracker.observe("clone-a", "machine-1", base); conflict != nil {
+ t.Fatalf("first report should not conflict, got %+v", conflict)
+ }
+ // First switch could be a legitimate rename, so it must not warn yet.
+ if conflict := tracker.observe("clone-b", "machine-1", base.Add(interval)); conflict != nil {
+ t.Fatalf("single hostname switch should not conflict, got %+v", conflict)
+ }
+ // The revisit of clone-a proves two machines are alternating.
+ conflict := tracker.observe("clone-a", "machine-1", base.Add(2*interval))
+ if conflict == nil {
+ t.Fatal("expected conflict after hostname revisit")
+ }
+ if len(conflict.Hostnames) != 2 || conflict.Hostnames[0] != "clone-a" || conflict.Hostnames[1] != "clone-b" {
+ t.Fatalf("expected sorted hostnames [clone-a clone-b], got %v", conflict.Hostnames)
+ }
+ if len(conflict.MachineIDs) != 0 {
+ t.Fatalf("shared machine ID should not be listed as conflicting, got %v", conflict.MachineIDs)
+ }
+ if conflict.FirstSeen.IsZero() || conflict.LastSeen.IsZero() {
+ t.Fatalf("expected conflict timestamps, got %+v", conflict)
+ }
+
+ // Continued flapping keeps the conflict alive and refreshes LastSeen.
+ later := tracker.observe("clone-b", "machine-1", base.Add(3*interval))
+ if later == nil {
+ t.Fatal("expected conflict to persist while flapping continues")
+ }
+ if !later.LastSeen.After(conflict.LastSeen) {
+ t.Fatalf("expected LastSeen to advance, got %v then %v", conflict.LastSeen, later.LastSeen)
+ }
+ if !later.FirstSeen.Equal(conflict.FirstSeen) {
+ t.Fatalf("expected FirstSeen to be stable, got %v then %v", conflict.FirstSeen, later.FirstSeen)
+ }
+}
+
+func TestDockerIdentityFlapTrackerIgnoresSingleRename(t *testing.T) {
+ tracker := newDockerIdentityFlapTracker()
+ base := time.Date(2026, 7, 16, 12, 0, 0, 0, time.UTC)
+
+ if conflict := tracker.observe("old-name", "machine-1", base); conflict != nil {
+ t.Fatalf("unexpected conflict: %+v", conflict)
+ }
+ for i := 1; i <= 5; i++ {
+ if conflict := tracker.observe("new-name", "machine-1", base.Add(time.Duration(i)*30*time.Second)); conflict != nil {
+ t.Fatalf("rename should never conflict, got %+v on report %d", conflict, i)
+ }
+ }
+}
+
+func TestDockerIdentityFlapTrackerConflictExpiresAfterWindow(t *testing.T) {
+ tracker := newDockerIdentityFlapTracker()
+ base := time.Date(2026, 7, 16, 12, 0, 0, 0, time.UTC)
+
+ tracker.observe("clone-a", "machine-1", base)
+ tracker.observe("clone-b", "machine-1", base.Add(30*time.Second))
+ if conflict := tracker.observe("clone-a", "machine-1", base.Add(60*time.Second)); conflict == nil {
+ t.Fatal("expected conflict after revisit")
+ }
+
+ // One clone goes away; steady reports from the survivor eventually clear it.
+ steady := base.Add(60 * time.Second).Add(dockerIdentityConflictWindow + time.Minute)
+ if conflict := tracker.observe("clone-a", "machine-1", steady); conflict != nil {
+ t.Fatalf("expected conflict to expire after quiet window, got %+v", conflict)
+ }
+}
+
+func TestDockerIdentityFlapTrackerDetectsAlternatingMachineIDs(t *testing.T) {
+ tracker := newDockerIdentityFlapTracker()
+ base := time.Date(2026, 7, 16, 12, 0, 0, 0, time.UTC)
+
+ tracker.observe("shared-host", "machine-a", base)
+ tracker.observe("shared-host", "machine-b", base.Add(30*time.Second))
+ conflict := tracker.observe("shared-host", "machine-a", base.Add(60*time.Second))
+ if conflict == nil {
+ t.Fatal("expected conflict after machine ID revisit")
+ }
+ if len(conflict.MachineIDs) != 2 || conflict.MachineIDs[0] != "machine-a" || conflict.MachineIDs[1] != "machine-b" {
+ t.Fatalf("expected sorted machine IDs [machine-a machine-b], got %v", conflict.MachineIDs)
+ }
+}
+
+func TestApplyDockerReportFlagsClonedMachineIDIdentity(t *testing.T) {
+ monitor := newTestMonitor(t)
+
+ report := func(hostname string, at time.Time) agentsdocker.Report {
+ return agentsdocker.Report{
+ Agent: agentsdocker.AgentInfo{
+ ID: "machine-duplicate",
+ Version: "6.0.0",
+ Type: "unified",
+ IntervalSeconds: 30,
+ },
+ Host: agentsdocker.HostInfo{
+ Hostname: hostname,
+ MachineID: "machine-duplicate",
+ TotalCPU: 4,
+ },
+ Timestamp: at,
+ }
+ }
+
+ base := time.Now().UTC()
+
+ first, err := monitor.ApplyDockerReport(report("clone-a", base), nil)
+ if err != nil {
+ t.Fatalf("first report: %v", err)
+ }
+ if first.IdentityConflict != nil {
+ t.Fatalf("first report should not conflict, got %+v", first.IdentityConflict)
+ }
+
+ second, err := monitor.ApplyDockerReport(report("clone-b", base.Add(30*time.Second)), nil)
+ if err != nil {
+ t.Fatalf("second report: %v", err)
+ }
+ if second.ID != first.ID {
+ t.Fatalf("expected clones to collapse into one identity, got %q vs %q", first.ID, second.ID)
+ }
+ if second.IdentityConflict != nil {
+ t.Fatalf("single hostname switch should not conflict yet, got %+v", second.IdentityConflict)
+ }
+
+ third, err := monitor.ApplyDockerReport(report("clone-a", base.Add(60*time.Second)), nil)
+ if err != nil {
+ t.Fatalf("third report: %v", err)
+ }
+ if third.IdentityConflict == nil {
+ t.Fatal("expected identity conflict once the hostname flapped back")
+ }
+ if got := third.IdentityConflict.Hostnames; len(got) != 2 || got[0] != "clone-a" || got[1] != "clone-b" {
+ t.Fatalf("expected conflict hostnames [clone-a clone-b], got %v", got)
+ }
+
+ hosts := monitor.state.GetDockerHosts()
+ if len(hosts) != 1 {
+ t.Fatalf("expected 1 collapsed host in state, got %d", len(hosts))
+ }
+ if hosts[0].IdentityConflict == nil {
+ t.Fatal("expected identity conflict to be stored on the state host")
+ }
+
+ // A healthy host keeps reporting the same identity and never conflicts.
+ steady, err := monitor.ApplyDockerReport(report("clone-a", base.Add(90*time.Second)), nil)
+ if err != nil {
+ t.Fatalf("steady report: %v", err)
+ }
+ if steady.IdentityConflict == nil {
+ t.Fatal("conflict should linger while inside the detection window")
+ }
+}
+
+func TestApplyDockerReportIdentityConflictClearedOnHostRemoval(t *testing.T) {
+ monitor := newTestMonitor(t)
+
+ base := time.Now().UTC()
+ mkReport := func(hostname string, at time.Time) agentsdocker.Report {
+ return agentsdocker.Report{
+ Agent: agentsdocker.AgentInfo{ID: "machine-dup", Type: "unified", Version: "6.0.0"},
+ Host: agentsdocker.HostInfo{Hostname: hostname, MachineID: "machine-dup"},
+ Timestamp: at,
+ }
+ }
+
+ host, err := monitor.ApplyDockerReport(mkReport("clone-a", base), nil)
+ if err != nil {
+ t.Fatalf("first report: %v", err)
+ }
+ if _, err = monitor.ApplyDockerReport(mkReport("clone-b", base.Add(time.Second)), nil); err != nil {
+ t.Fatalf("second report: %v", err)
+ }
+ if _, err = monitor.ApplyDockerReport(mkReport("clone-a", base.Add(2*time.Second)), nil); err != nil {
+ t.Fatalf("third report: %v", err)
+ }
+
+ monitor.mu.Lock()
+ if _, ok := monitor.dockerIdentityFlaps[host.ID]; !ok {
+ monitor.mu.Unlock()
+ t.Fatal("expected flap tracker for host identity")
+ }
+ monitor.clearDockerHostIdentityTrackingLocked(host.ID)
+ if _, ok := monitor.dockerIdentityFlaps[host.ID]; ok {
+ monitor.mu.Unlock()
+ t.Fatal("expected flap tracker to be cleared")
+ }
+ monitor.mu.Unlock()
+}
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index 0f4b980701..4f7e9715f0 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -1012,12 +1012,13 @@ type Monitor struct {
nodeRRDMemCache map[string]rrdMemCacheEntry
vmRRDMemCache map[string]rrdMemCacheEntry
vmAgentMemCache map[string]agentMemCacheEntry
- removedDockerHosts map[string]time.Time // Track deliberately removed Docker hosts (ID -> removal time)
- dockerTokenBindings map[string]string // Track token ID -> Docker host identity bindings to enforce uniqueness
- removedKubernetesClusters map[string]time.Time // Track deliberately removed Kubernetes clusters (ID -> removal time)
- kubernetesTokenBindings map[string]string // Track token ID -> agent ID bindings to enforce uniqueness
- removedHostAgents map[string]time.Time // Track deliberately removed host agents (ID -> removal time)
- hostTokenBindings map[string]string // Track tokenID:hostname -> host identity bindings
+ removedDockerHosts map[string]time.Time // Track deliberately removed Docker hosts (ID -> removal time)
+ dockerTokenBindings map[string]string // Track token ID -> Docker host identity bindings to enforce uniqueness
+ dockerIdentityFlaps map[string]*dockerIdentityFlapTracker // Track per-host identity flapping (cloned VMs sharing machine-id)
+ removedKubernetesClusters map[string]time.Time // Track deliberately removed Kubernetes clusters (ID -> removal time)
+ kubernetesTokenBindings map[string]string // Track token ID -> agent ID bindings to enforce uniqueness
+ removedHostAgents map[string]time.Time // Track deliberately removed host agents (ID -> removal time)
+ hostTokenBindings map[string]string // Track tokenID:hostname -> host identity bindings
dockerCommands map[string]*dockerHostCommand
dockerCommandIndex map[string]string
guestMetadataMu sync.RWMutex
@@ -1574,6 +1575,7 @@ func New(cfg *config.Config) (*Monitor, error) {
vmAgentMemCache: make(map[string]agentMemCacheEntry),
removedDockerHosts: make(map[string]time.Time),
dockerTokenBindings: make(map[string]string),
+ dockerIdentityFlaps: make(map[string]*dockerIdentityFlapTracker),
removedKubernetesClusters: make(map[string]time.Time),
kubernetesTokenBindings: make(map[string]string),
removedHostAgents: make(map[string]time.Time),
@@ -3698,6 +3700,7 @@ func dockerHostFromReadStateView(view *unifiedresources.DockerHostView) models.D
PendingUninstall: view.PendingUninstall(),
Command: view.Command(),
IsLegacy: view.IsLegacy(),
+ IdentityConflict: view.IdentityConflict(),
NetInRate: view.NetInRate(),
NetOutRate: view.NetOutRate(),
DiskReadRate: view.DiskReadRate(),
diff --git a/internal/monitoring/monitor_agents.go b/internal/monitoring/monitor_agents.go
index 8961e8a3a8..c0b4277b4e 100644
--- a/internal/monitoring/monitor_agents.go
+++ b/internal/monitoring/monitor_agents.go
@@ -77,6 +77,7 @@ func (m *Monitor) RemoveDockerHost(hostID string) (models.DockerHost, error) {
delete(m.dockerCommandIndex, cmd.status.ID)
}
delete(m.dockerCommands, hostID)
+ m.clearDockerHostIdentityTrackingLocked(hostID)
m.mu.Unlock()
m.state.AddRemovedDockerHost(models.RemovedDockerHost{
@@ -1079,6 +1080,7 @@ func (m *Monitor) ClearUnauthenticatedAgents() (int, int) {
m.mu.Lock()
m.dockerTokenBindings = make(map[string]string)
m.hostTokenBindings = make(map[string]string)
+ m.dockerIdentityFlaps = make(map[string]*dockerIdentityFlapTracker)
m.mu.Unlock()
if hostCount > 0 || dockerCount > 0 {
@@ -1454,6 +1456,18 @@ func (m *Monitor) ApplyDockerReport(report agentsdocker.Report, tokenRecord *con
agentVersion = normalizeAgentVersion(previous.AgentVersion())
}
+ // Detect distinct machines flapping under one identity (e.g. cloned VMs
+ // sharing /etc/machine-id, #1584) so the UI can warn instead of silently
+ // letting the reports overwrite each other.
+ identityConflict := m.trackDockerHostIdentity(identifier, hostname, strings.TrimSpace(report.Host.MachineID), receivedAt)
+ if identityConflict != nil {
+ log.Warn().
+ Str("dockerHostID", identifier).
+ Strs("hostnames", identityConflict.Hostnames).
+ Strs("machineIDs", identityConflict.MachineIDs).
+ Msg("Multiple machines appear to report under one Docker host identity (cloned VMs sharing /etc/machine-id?)")
+ }
+
host := models.DockerHost{
ID: identifier,
AgentID: agentID,
@@ -1491,6 +1505,7 @@ func (m *Monitor) ApplyDockerReport(report agentsdocker.Report, tokenRecord *con
Swarm: swarmInfo,
Security: security,
IsLegacy: isLegacyAgent(report.Agent.Type),
+ IdentityConflict: identityConflict,
}
if hasPrevious {
diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.go
index 2944f0b3bf..78ae1ac854 100644
--- a/internal/unifiedresources/adapters.go
+++ b/internal/unifiedresources/adapters.go
@@ -1329,6 +1329,7 @@ func resourceFromDockerHost(host models.DockerHost) (Resource, ResourceIdentity)
IsLegacy: host.IsLegacy,
Command: cloneDockerHostCommandStatus(host.Command),
Security: cloneDockerHostSecurity(host.Security),
+ IdentityConflict: cloneDockerHostIdentityConflict(host.IdentityConflict),
Swarm: convertSwarm(host.Swarm),
NetworkInterfaces: convertInterfaces(host.NetworkInterfaces),
Disks: convertDisks(host.Disks),
diff --git a/internal/unifiedresources/clone.go b/internal/unifiedresources/clone.go
index 684b6cd759..f8518eb54c 100644
--- a/internal/unifiedresources/clone.go
+++ b/internal/unifiedresources/clone.go
@@ -253,6 +253,7 @@ func cloneDockerData(in *DockerData) *DockerData {
out.ObjectUpdatedAt = cloneTimePtr(in.ObjectUpdatedAt)
out.Command = cloneDockerHostCommandStatus(in.Command)
out.Security = cloneDockerHostSecurity(in.Security)
+ out.IdentityConflict = cloneDockerHostIdentityConflict(in.IdentityConflict)
out.Swarm = cloneDockerSwarmInfo(in.Swarm)
out.NetworkInterfaces = cloneNetworkInterfaces(in.NetworkInterfaces)
out.Disks = cloneDiskInfos(in.Disks)
@@ -801,6 +802,16 @@ func cloneDockerHostSecurity(in *models.DockerHostSecurity) *models.DockerHostSe
return &out
}
+func cloneDockerHostIdentityConflict(in *models.DockerHostIdentityConflict) *models.DockerHostIdentityConflict {
+ if in == nil {
+ return nil
+ }
+ out := *in
+ out.Hostnames = append([]string(nil), in.Hostnames...)
+ out.MachineIDs = append([]string(nil), in.MachineIDs...)
+ return &out
+}
+
func clonePMGMailStatsMeta(in *PMGMailStatsMeta) *PMGMailStatsMeta {
if in == nil {
return nil
diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.go
index 422adfbe5d..ba289286c4 100644
--- a/internal/unifiedresources/code_standards_test.go
+++ b/internal/unifiedresources/code_standards_test.go
@@ -492,6 +492,35 @@ func TestCloneResourceClonesDockerSecurityPosture(t *testing.T) {
}
}
+func TestCloneResourceClonesDockerIdentityConflict(t *testing.T) {
+ original := Resource{
+ ID: "agent:docker-host-1",
+ Type: ResourceTypeAgent,
+ Docker: &DockerData{
+ HostSourceID: "docker-host-1",
+ Runtime: "docker",
+ IdentityConflict: &models.DockerHostIdentityConflict{
+ Hostnames: []string{"clone-a", "clone-b"},
+ MachineIDs: []string{"machine-shared"},
+ },
+ },
+ }
+
+ cloned := cloneResource(&original)
+ if cloned.Docker == nil || cloned.Docker.IdentityConflict == nil {
+ t.Fatalf("clone lost docker identity conflict evidence: %#v", cloned.Docker)
+ }
+ if !reflect.DeepEqual(cloned.Docker.IdentityConflict, original.Docker.IdentityConflict) {
+ t.Fatalf("identity conflict clone = %#v, want %#v",
+ cloned.Docker.IdentityConflict, original.Docker.IdentityConflict)
+ }
+
+ cloned.Docker.IdentityConflict.Hostnames[0] = "changed"
+ if got := original.Docker.IdentityConflict.Hostnames[0]; got != "clone-a" {
+ t.Fatalf("identity conflict was aliased through clone, original hostname = %q", got)
+ }
+}
+
func TestCloneResourcePreservesDockerCPUCapacityMetadata(t *testing.T) {
original := Resource{
ID: "app-container:docker-host-1:web",
diff --git a/internal/unifiedresources/types.go b/internal/unifiedresources/types.go
index eb18a24f4d..5df164b372 100644
--- a/internal/unifiedresources/types.go
+++ b/internal/unifiedresources/types.go
@@ -981,28 +981,29 @@ type DockerData struct {
DiskWriteRate float64 `json:"diskWriteRate,omitempty"`
// Host-level summary fields (populated when Resource.Type == ResourceTypeAgent and Docker != nil)
- ContainerCount int `json:"containerCount,omitempty"`
- ImageCount int `json:"imageCount,omitempty"`
- VolumeCount int `json:"volumeCount,omitempty"`
- NetworkCount int `json:"networkCount,omitempty"`
- NodeCount int `json:"nodeCount,omitempty"`
- SecretCount int `json:"secretCount,omitempty"`
- ConfigCount int `json:"configCount,omitempty"`
- UpdatesAvailableCount int `json:"updatesAvailableCount,omitempty"`
- UpdatesLastCheckedAt *time.Time `json:"updatesLastCheckedAt,omitempty"`
- ImagesUsage *DockerStorageUsageMeta `json:"imagesUsage,omitempty"`
- ContainersUsage *DockerStorageUsageMeta `json:"containersUsage,omitempty"`
- VolumesUsage *DockerStorageUsageMeta `json:"volumesUsage,omitempty"`
- BuildCacheUsage *DockerStorageUsageMeta `json:"buildCacheUsage,omitempty"`
- TokenID string `json:"tokenId,omitempty"`
- TokenName string `json:"tokenName,omitempty"`
- TokenHint string `json:"tokenHint,omitempty"`
- TokenLastUsedAt *time.Time `json:"tokenLastUsedAt,omitempty"`
- Hidden bool `json:"hidden,omitempty"`
- PendingUninstall bool `json:"pendingUninstall,omitempty"`
- IsLegacy bool `json:"isLegacy,omitempty"`
- Command *models.DockerHostCommandStatus `json:"command,omitempty"`
- Security *models.DockerHostSecurity `json:"security,omitempty"`
+ ContainerCount int `json:"containerCount,omitempty"`
+ ImageCount int `json:"imageCount,omitempty"`
+ VolumeCount int `json:"volumeCount,omitempty"`
+ NetworkCount int `json:"networkCount,omitempty"`
+ NodeCount int `json:"nodeCount,omitempty"`
+ SecretCount int `json:"secretCount,omitempty"`
+ ConfigCount int `json:"configCount,omitempty"`
+ UpdatesAvailableCount int `json:"updatesAvailableCount,omitempty"`
+ UpdatesLastCheckedAt *time.Time `json:"updatesLastCheckedAt,omitempty"`
+ ImagesUsage *DockerStorageUsageMeta `json:"imagesUsage,omitempty"`
+ ContainersUsage *DockerStorageUsageMeta `json:"containersUsage,omitempty"`
+ VolumesUsage *DockerStorageUsageMeta `json:"volumesUsage,omitempty"`
+ BuildCacheUsage *DockerStorageUsageMeta `json:"buildCacheUsage,omitempty"`
+ TokenID string `json:"tokenId,omitempty"`
+ TokenName string `json:"tokenName,omitempty"`
+ TokenHint string `json:"tokenHint,omitempty"`
+ TokenLastUsedAt *time.Time `json:"tokenLastUsedAt,omitempty"`
+ Hidden bool `json:"hidden,omitempty"`
+ PendingUninstall bool `json:"pendingUninstall,omitempty"`
+ IsLegacy bool `json:"isLegacy,omitempty"`
+ Command *models.DockerHostCommandStatus `json:"command,omitempty"`
+ Security *models.DockerHostSecurity `json:"security,omitempty"`
+ IdentityConflict *models.DockerHostIdentityConflict `json:"identityConflict,omitempty"`
// Container-specific fields (populated when Resource.Type == ResourceTypeAppContainer)
ContainerState string `json:"containerState,omitempty"`
diff --git a/internal/unifiedresources/views.go b/internal/unifiedresources/views.go
index 6a9235cc14..251423cc33 100644
--- a/internal/unifiedresources/views.go
+++ b/internal/unifiedresources/views.go
@@ -1770,6 +1770,13 @@ func (v DockerHostView) Security() *models.DockerHostSecurity {
return &copied
}
+func (v DockerHostView) IdentityConflict() *models.DockerHostIdentityConflict {
+ if v.r == nil || v.r.Docker == nil {
+ return nil
+ }
+ return cloneDockerHostIdentityConflict(v.r.Docker.IdentityConflict)
+}
+
// StoragePoolView wraps a storage resource.
type StoragePoolView struct{ r *Resource }
diff --git a/internal/unifiedresources/views_test.go b/internal/unifiedresources/views_test.go
index 994fb6dd2b..1d48858141 100644
--- a/internal/unifiedresources/views_test.go
+++ b/internal/unifiedresources/views_test.go
@@ -958,10 +958,13 @@ func TestView_DockerHostViewAccessors(t *testing.T) {
IsLegacy: true,
Command: command,
Swarm: swarm,
- NetInRate: 101.5,
- NetOutRate: 102.5,
- DiskReadRate: 103.5,
- DiskWriteRate: 104.5,
+ IdentityConflict: &models.DockerHostIdentityConflict{
+ Hostnames: []string{"docker-host-1", "docker-host-1-clone"},
+ },
+ NetInRate: 101.5,
+ NetOutRate: 102.5,
+ DiskReadRate: 103.5,
+ DiskWriteRate: 104.5,
NetworkInterfaces: []NetworkInterface{
{Name: "eno1", Addresses: []string{"10.0.0.40/24"}, SpeedMbps: &speed},
},
@@ -1006,6 +1009,14 @@ func TestView_DockerHostViewAccessors(t *testing.T) {
if v.Swarm() == nil || v.Swarm().ClusterID != "swarm-1" || v.Swarm().NodeRole != "manager" {
t.Fatalf("expected swarm info, got %+v", v.Swarm())
}
+ conflict := v.IdentityConflict()
+ if conflict == nil || len(conflict.Hostnames) != 2 || conflict.Hostnames[1] != "docker-host-1-clone" {
+ t.Fatalf("expected identity conflict evidence, got %+v", conflict)
+ }
+ conflict.Hostnames[0] = "mutated"
+ if r.Docker.IdentityConflict.Hostnames[0] != "docker-host-1" {
+ t.Fatal("IdentityConflict accessor must return an independent copy")
+ }
if len(v.NetworkInterfaces()) != 1 || v.NetworkInterfaces()[0].Name != "eno1" {
t.Fatalf("expected network interface data, got %+v", v.NetworkInterfaces())
}