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.

Deduplicate represented infrastructure hosts by alias

rcourtman60f97ccd5160
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index bde4d5240e..3a4dabbe5c 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -404,7 +404,13 @@ an add-only capacity posture.
must not reconstruct per-type health, scope, or last-seen columns
from any retired reporting-local state for configured connection
rows; the aggregator is the only configured-connections source of
- truth. Per-row Edit, Pause/Resume, and Remove actions live directly
+ truth. That same aggregator-authored connection/member payload also owns
+ discovery reconciliation for already represented hosts: when a platform
+ row, its attached agent augmentation, or one of its child members already
+ carries canonical host aliases, the settings shell must suppress any
+ duplicate discovery candidate for that same platform instead of asking the
+ operator to review the same machine twice under a hostname row and an
+ IP-only candidate row. Per-row Edit, Pause/Resume, and Remove actions live directly
on the `ConnectionsTable` row — wired through
`frontend-modern/src/components/Settings/useConnectionRowActions.ts`
which owns pause/remove API dispatch, two-click remove confirm, and
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 667a80b3f7..93cb09db86 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -427,7 +427,13 @@ the canonical monitored-system blocked payload.
payload must also carry the backend-authored cluster member collection
with node identity, endpoint, node-local status, and any linked agent
connection id so the frontend can render child node composition without
- reverse-engineering it from standalone agent rows. Agent-backed
+ reverse-engineering it from standalone agent rows. Those member records,
+ plus any primary or attached connection row that represents the same host,
+ must also carry canonical host aliases when the backend knows them, so
+ discovery and settings surfaces can reconcile hostname-only and IP-only
+ views of the same enrolled machine instead of showing a second
+ "discovered" candidate row for an already represented source member or
+ API-plus-agent source row. Agent-backed
connections also own canonical version/update facts on that same payload:
when a source or attachment is backed by Pulse Agent, `/api/connections`
carries the
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index f04790c7ac..0b159283ab 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -331,6 +331,14 @@ work extends shared components instead of creating new local variants.
backend-authored cluster members, the table primitive must render those
nodes as child composition beneath the cluster row rather than flattening
them back into peer top-level systems or hiding them entirely.
+ That same landing-shell boundary also owns represented-host dedupe between
+ the unified ledger and the discovery strip. `InfrastructureWorkspace.tsx`,
+ `frontend-modern/src/components/Settings/useConnectionsLedger.ts`, and
+ `frontend-modern/src/components/Settings/infrastructureSettingsModel.ts`
+ must treat backend-authored hostname/IP aliases as canonical identity so an
+ already-represented platform row, attached agent augmentation, or grouped
+ member suppresses the matching discovered candidate instead of showing the
+ same machine twice under hostname-versus-IP drift.
Phase 9 retired the
parallel reporting/inventory surface entirely:
`useInfrastructureReportingState`, `InfrastructureOperationsController`,
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 31d05005b6..76b2b367c5 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -152,6 +152,15 @@ querying, and the operator-facing storage health presentation layer.
any adjacent recovery-rollup query, so hidden workload-route selectors do
not hydrate storage/recovery transport on the protected hot path.
6. Preserve API-owned node identity continuity in shared `internal/api/` helpers so storage and recovery transport attachments do not fork by hostname-versus-IP drift across the same runtime.
+ That same adjacent `internal/api/` boundary also owns canonical
+ host-alias propagation on grouped-system and attached-connection payloads.
+ `internal/api/connections_types.go`,
+ `internal/api/connections_grouping.go`, and
+ `internal/api/connections_aggregator.go` must publish normalized
+ `hostAliases` whenever shared discovery or provider-backed inventory could
+ observe the same node by hostname and IP, so storage- and
+ recovery-adjacent consumers inherit one canonical represented-host identity
+ instead of inventing local merge heuristics.
That same adjacent `internal/api/` boundary also keeps public hosted signup
commercial-only: storage and recovery surfaces must not infer tenant
existence, email issuance, or readiness from `/api/public/signup` response
diff --git a/frontend-modern/src/api/__tests__/connections.test.ts b/frontend-modern/src/api/__tests__/connections.test.ts
index 7ae8e210c3..12650300ff 100644
--- a/frontend-modern/src/api/__tests__/connections.test.ts
+++ b/frontend-modern/src/api/__tests__/connections.test.ts
@@ -25,6 +25,7 @@ describe('ConnectionsAPI', () => {
type: 'pve',
name: 'lab',
address: 'https://pve.lab:8006',
+ hostAliases: ['lab', '192.168.0.2'],
state: 'active',
stateReason: '',
enabled: true,
@@ -47,6 +48,7 @@ describe('ConnectionsAPI', () => {
id: 'node-lab',
name: 'lab',
endpoint: 'https://lab:8006',
+ hostAliases: ['lab', '192.168.0.2'],
state: 'active',
lastSeen: '2026-04-23T12:00:00Z',
primary: true,
@@ -102,6 +104,53 @@ describe('ConnectionsAPI', () => {
});
});
+ it('list() preserves canonical host alias metadata on connections and grouped members', async () => {
+ mockedApiFetchJSON.mockResolvedValueOnce({
+ connections: [
+ {
+ id: 'agent:pi',
+ type: 'agent',
+ name: 'pi',
+ address: 'pi',
+ hostAliases: ['pi', '192.168.0.2'],
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['host'],
+ scope: { host: true },
+ lastSeen: '2026-04-23T13:00:00Z',
+ lastError: null,
+ source: 'agent',
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ },
+ ],
+ systems: [
+ {
+ id: 'pve:pi',
+ type: 'pve',
+ components: [
+ { connectionId: 'pve:pi', type: 'pve', role: 'primary' },
+ { connectionId: 'agent:pi', type: 'agent', role: 'attachment' },
+ ],
+ members: [
+ {
+ id: 'pve:pi:member',
+ name: 'pi',
+ endpoint: 'https://pi:8006',
+ hostAliases: ['pi', '192.168.0.2'],
+ state: 'active',
+ },
+ ],
+ },
+ ],
+ });
+
+ const result = await ConnectionsAPI.list();
+
+ expect(result.connections[0]?.hostAliases).toEqual(['pi', '192.168.0.2']);
+ expect(result.systems[0]?.members?.[0]?.hostAliases).toEqual(['pi', '192.168.0.2']);
+ });
+
it('probe() POSTs the address JSON and returns the candidates envelope', async () => {
const response: ProbeResponse = {
candidates: [
diff --git a/frontend-modern/src/api/connections.ts b/frontend-modern/src/api/connections.ts
index 3c0ea4636d..a19d4876d5 100644
--- a/frontend-modern/src/api/connections.ts
+++ b/frontend-modern/src/api/connections.ts
@@ -37,6 +37,7 @@ export interface Connection {
type: ConnectionType;
name: string;
address: string;
+ hostAliases?: string[];
state: ConnectionState;
stateReason: string;
enabled: boolean;
@@ -63,6 +64,7 @@ export interface ConnectionSystemMember {
id: string;
name: string;
endpoint?: string;
+ hostAliases?: string[];
state: ConnectionState;
lastSeen?: string | null;
primary?: boolean;
diff --git a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
index e7c80de78e..3c06d9ddf6 100644
--- a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
@@ -47,7 +47,10 @@ import {
getInfrastructureOnboardingProductPresentation,
type InfrastructureOnboardingConnectionType,
} from '@/utils/infrastructureOnboardingPresentation';
-import type { DiscoveredServer } from './infrastructureSettingsModel';
+import {
+ filterRepresentedDiscoveredServers,
+ type DiscoveredServer,
+} from './infrastructureSettingsModel';
export type InfrastructureWorkspaceProps = InfrastructurePlatformSettingsProps;
@@ -156,6 +159,13 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
};
const rows = createMemo(() => ledger.rows());
+ const visibleDiscoveredNodes = createMemo(() =>
+ filterRepresentedDiscoveredServers(
+ props.discoveredNodes(),
+ [...props.pveNodes(), ...props.pbsNodes(), ...props.pmgNodes()],
+ rows(),
+ ),
+ );
const agentUninstallCommands = createMemo<AgentUninstallCommands>(() => ({
linux: operations.getUninstallCommand(),
@@ -833,7 +843,7 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
<div class="space-y-6">
<InfrastructureSourceManager
rows={rows}
- discoveredNodes={props.discoveredNodes}
+ discoveredNodes={visibleDiscoveredNodes}
discoveryEnabled={props.discoveryEnabled()}
discoveryScanStatus={props.discoveryScanStatus}
readOnly={readOnly()}
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
index 9a43f6f06e..e7c014fbb7 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
@@ -194,4 +194,12 @@ describe('infrastructure operations model', () => {
).then((mod) => (mod as { default: string }).default);
expect(operationsStateSource).not.toContain('useInfrastructureReportingState');
});
+
+ it('keeps discovered-node filtering anchored to canonical represented-host dedupe', async () => {
+ const discoveryStateSource = await import(
+ '../useInfrastructureDiscoveryRuntimeState?raw'
+ ).then((mod) => (mod as { default: string }).default);
+ expect(discoveryStateSource).toContain('filterRepresentedDiscoveredServers');
+ expect(discoveryStateSource).toContain('nodes()');
+ });
});
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
index 7916d4b7cb..9f453f1fea 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
@@ -83,6 +83,7 @@ vi.mock('../useConnectionsLedger', () => ({
canPause: connection.capabilities.supportsPause,
canRemove: connection.type !== 'docker' && connection.type !== 'kubernetes',
isAgent: connection.type === 'agent',
+ isCluster: false,
attachedConnections: [],
members: [],
connection,
@@ -286,6 +287,68 @@ describe('InfrastructureWorkspace', () => {
});
});
+ it('hides discovered candidates already represented by the unified connections ledger member aliases', async () => {
+ connectionState.rows = [
+ {
+ id: 'pve:homelab',
+ ownerType: 'pve',
+ name: 'homelab',
+ subtitle: 'Cluster · 1 node',
+ source: 'api',
+ host: undefined,
+ coverageLabels: ['VMs', 'Containers', 'Storage', 'Backups'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ agentUpdateCount: 0,
+ lastActivityText: '3s ago',
+ enabled: true,
+ canEdit: true,
+ canPause: true,
+ canRemove: true,
+ isAgent: false,
+ isCluster: true,
+ attachedConnections: [],
+ members: [
+ {
+ id: 'node-pi',
+ name: 'pi',
+ subtitle: 'API contact',
+ source: 'agent',
+ host: 'https://pi:8006',
+ hostAliases: ['pi', '192.168.0.2'],
+ coverageLabels: ['Host telemetry'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ lastActivityText: '3s ago',
+ primary: true,
+ },
+ ],
+ connection: connectionFixture({
+ id: 'pve:homelab',
+ name: 'homelab',
+ address: 'https://pi:8006',
+ }),
+ },
+ ];
+
+ renderWorkspace({
+ discoveredNodes: () => [
+ {
+ ip: '192.168.0.2',
+ port: 8006,
+ type: 'pve',
+ version: '8.2.2',
+ },
+ ],
+ discoveryScanStatus: () => ({ scanning: false, lastResultAt: Date.now() }),
+ });
+
+ await waitFor(() => expect(screen.getByText('homelab')).toBeInTheDocument());
+ expect(screen.queryByText('192.168.0.2')).not.toBeInTheDocument();
+ expect(screen.queryByText('Discovered')).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: /^Review$/i })).toBeNull();
+ });
+
it('opens a type-specific add route from the matching platform section', () => {
renderWorkspace();
@@ -437,6 +500,7 @@ describe('InfrastructureWorkspace', () => {
canPause: true,
canRemove: true,
isAgent: false,
+ isCluster: false,
attachedConnections: [attachedAgent],
members: [],
connection: primaryConnection,
@@ -490,10 +554,10 @@ describe('InfrastructureWorkspace', () => {
id: primaryConnection.id,
ownerType: 'pve',
name: 'homelab',
- subtitle: 'via platform API and Pulse Agent',
- source: 'both',
- host: primaryConnection.address,
- coverageLabels: ['VMs', 'Containers', 'Storage', 'Backups', 'Host telemetry'],
+ subtitle: 'Cluster · 2 nodes',
+ source: 'api',
+ host: undefined,
+ coverageLabels: ['VMs', 'Containers', 'Storage', 'Backups'],
statusLabel: 'Active',
statusClassName: 'bg-green-100 text-green-800',
agentUpdateCount: 0,
@@ -503,13 +567,14 @@ describe('InfrastructureWorkspace', () => {
canPause: true,
canRemove: true,
isAgent: false,
+ isCluster: true,
attachedConnections: [dellyAgent, minipcAgent],
members: [
{
id: 'node-delly',
name: 'delly',
- subtitle: 'Primary cluster node',
- source: 'both',
+ subtitle: 'API contact',
+ source: 'agent',
host: 'https://delly:8006',
coverageLabels: ['Host telemetry'],
statusLabel: 'Active',
@@ -522,7 +587,7 @@ describe('InfrastructureWorkspace', () => {
id: 'node-minipc',
name: 'minipc',
subtitle: 'Cluster member',
- source: 'both',
+ source: 'agent',
host: 'https://minipc:8006',
coverageLabels: ['Host telemetry'],
statusLabel: 'Active',
@@ -539,7 +604,9 @@ describe('InfrastructureWorkspace', () => {
renderWorkspace();
await waitFor(() => expect(screen.getByText('homelab')).toBeInTheDocument());
- expect(screen.getAllByText('API + Agent').length).toBeGreaterThan(0);
+ expect(screen.getByText('Cluster · 2 nodes')).toBeInTheDocument();
+ expect(screen.getByText('API contact')).toBeInTheDocument();
+ expect(screen.getAllByText('Agent').length).toBeGreaterThan(0);
expect(screen.getByText('delly')).toBeInTheDocument();
expect(screen.getByText('minipc')).toBeInTheDocument();
expect(screen.getAllByText('Host telemetry').length).toBeGreaterThan(0);
diff --git a/frontend-modern/src/components/Settings/__tests__/infrastructureSettingsModel.test.ts b/frontend-modern/src/components/Settings/__tests__/infrastructureSettingsModel.test.ts
new file mode 100644
index 0000000000..559101af61
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/infrastructureSettingsModel.test.ts
@@ -0,0 +1,206 @@
+import { describe, expect, it } from 'vitest';
+import { filterRepresentedDiscoveredServers } from '../infrastructureSettingsModel';
+import type { InfrastructureSystemRow } from '../connectionsTableModel';
+
+describe('filterRepresentedDiscoveredServers', () => {
+ it('removes a discovered platform candidate when the same platform member is already represented by host aliases', () => {
+ const rows: InfrastructureSystemRow[] = [
+ {
+ id: 'pve:homelab',
+ ownerType: 'pve',
+ name: 'homelab',
+ subtitle: 'Cluster · 1 node',
+ source: 'api',
+ host: undefined,
+ coverageLabels: ['VMs', 'Containers', 'Storage', 'Backups'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ agentUpdateCount: 0,
+ lastActivityText: '4s ago',
+ enabled: true,
+ canEdit: true,
+ canPause: true,
+ canRemove: true,
+ isAgent: false,
+ isCluster: true,
+ attachedConnections: [],
+ members: [
+ {
+ id: 'node-pi',
+ name: 'pi',
+ subtitle: 'API contact',
+ source: 'agent',
+ host: 'https://pi:8006',
+ hostAliases: ['pi', '192.168.0.2'],
+ coverageLabels: ['Host telemetry'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ lastActivityText: '4s ago',
+ primary: true,
+ },
+ ],
+ connection: {
+ id: 'pve:homelab',
+ type: 'pve',
+ name: 'homelab',
+ address: 'https://pi:8006',
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['vms', 'containers', 'storage', 'backups'],
+ scope: { vms: true, containers: true, storage: true, backups: true },
+ lastSeen: '2026-04-23T12:00:00Z',
+ lastError: null,
+ source: 'manual',
+ capabilities: { supportsPause: true, supportsScope: true, supportsTest: true },
+ },
+ },
+ ];
+
+ const filtered = filterRepresentedDiscoveredServers(
+ [
+ {
+ ip: '192.168.0.2',
+ port: 8006,
+ type: 'pve',
+ version: '8.2.2',
+ },
+ ],
+ [],
+ rows,
+ );
+
+ expect(filtered).toEqual([]);
+ });
+
+ it('keeps a discovered platform candidate when the matching host is only represented by an agent row', () => {
+ const rows: InfrastructureSystemRow[] = [
+ {
+ id: 'agent:pi',
+ ownerType: 'agent',
+ name: 'pi',
+ subtitle: 'via Pulse Agent',
+ source: 'agent',
+ host: undefined,
+ coverageLabels: ['Host telemetry'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ agentUpdateCount: 0,
+ lastActivityText: '4s ago',
+ enabled: true,
+ canEdit: false,
+ canPause: false,
+ canRemove: true,
+ isAgent: true,
+ isCluster: false,
+ attachedConnections: [],
+ members: [],
+ connection: {
+ id: 'agent:pi',
+ type: 'agent',
+ name: 'pi',
+ address: 'pi',
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['host'],
+ scope: { host: true },
+ lastSeen: '2026-04-23T12:00:00Z',
+ lastError: null,
+ source: 'agent',
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ },
+ },
+ ];
+
+ const filtered = filterRepresentedDiscoveredServers(
+ [
+ {
+ ip: '192.168.0.2',
+ port: 8006,
+ type: 'pve',
+ version: '8.2.2',
+ hostname: 'pi',
+ },
+ ],
+ [],
+ rows,
+ );
+
+ expect(filtered).toHaveLength(1);
+ expect(filtered[0]?.ip).toBe('192.168.0.2');
+ });
+
+ it('removes a discovered platform candidate when the platform row carries an attached agent alias for the same host', () => {
+ const rows: InfrastructureSystemRow[] = [
+ {
+ id: 'pve:pi',
+ ownerType: 'pve',
+ name: 'pi',
+ subtitle: 'via platform API and Pulse Agent',
+ source: 'both',
+ host: 'https://pi:8006',
+ coverageLabels: ['VMs', 'Containers', 'Storage', 'Backups', 'Host telemetry'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ agentUpdateCount: 0,
+ lastActivityText: '4s ago',
+ enabled: true,
+ canEdit: true,
+ canPause: true,
+ canRemove: true,
+ isAgent: false,
+ isCluster: false,
+ attachedConnections: [
+ {
+ id: 'agent:pi',
+ type: 'agent',
+ name: 'pi',
+ address: 'pi',
+ hostAliases: ['pi', '192.168.0.2'],
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['host'],
+ scope: { host: true },
+ lastSeen: '2026-04-23T12:00:00Z',
+ lastError: null,
+ source: 'agent',
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ },
+ ],
+ members: [],
+ connection: {
+ id: 'pve:pi',
+ type: 'pve',
+ name: 'pi',
+ address: 'https://pi:8006',
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['vms', 'containers', 'storage', 'backups'],
+ scope: { vms: true, containers: true, storage: true, backups: true },
+ lastSeen: '2026-04-23T12:00:00Z',
+ lastError: null,
+ source: 'manual',
+ capabilities: { supportsPause: true, supportsScope: true, supportsTest: true },
+ },
+ },
+ ];
+
+ const filtered = filterRepresentedDiscoveredServers(
+ [
+ {
+ ip: '192.168.0.2',
+ port: 8006,
+ type: 'pve',
+ version: '8.2.2',
+ },
+ ],
+ [],
+ rows,
+ );
+
+ expect(filtered).toEqual([]);
+ });
+});
diff --git a/frontend-modern/src/components/Settings/__tests__/useConnectionsLedger.test.ts b/frontend-modern/src/components/Settings/__tests__/useConnectionsLedger.test.ts
index 43b5d6e87e..690debcff1 100644
--- a/frontend-modern/src/components/Settings/__tests__/useConnectionsLedger.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/useConnectionsLedger.test.ts
@@ -71,6 +71,7 @@ describe('useConnectionsLedger', () => {
id: 'node-delly',
name: 'delly',
endpoint: 'https://delly:8006',
+ hostAliases: ['delly', '192.168.0.10'],
state: 'active',
lastSeen: '2026-04-23T12:00:00Z',
primary: true,
@@ -80,6 +81,7 @@ describe('useConnectionsLedger', () => {
id: 'node-minipc',
name: 'minipc',
endpoint: 'https://minipc:8006',
+ hostAliases: ['minipc', '192.168.0.11'],
state: 'active',
lastSeen: '2026-04-23T12:00:00Z',
agentConnectionId: 'agent:agent-minipc',
@@ -96,8 +98,11 @@ describe('useConnectionsLedger', () => {
id: 'pve:delly',
ownerType: 'pve',
name: 'homelab',
- source: 'both',
- host: 'https://delly:8006',
+ subtitle: 'Cluster · 2 nodes',
+ source: 'api',
+ host: undefined,
+ isCluster: true,
+ coverageLabels: ['VMs', 'Containers', 'Storage', 'Backups'],
});
expect(result.rows()[0].attachedConnections.map((connection) => connection.id)).toEqual([
'agent:agent-delly',
@@ -107,9 +112,10 @@ describe('useConnectionsLedger', () => {
{
id: 'node-delly',
name: 'delly',
- subtitle: 'Primary cluster node',
- source: 'both',
+ subtitle: 'API contact',
+ source: 'agent',
host: 'https://delly:8006',
+ hostAliases: ['delly', '192.168.0.10'],
coverageLabels: ['Host telemetry'],
statusLabel: 'Active',
primary: true,
@@ -118,8 +124,9 @@ describe('useConnectionsLedger', () => {
id: 'node-minipc',
name: 'minipc',
subtitle: 'Cluster member',
- source: 'both',
+ source: 'agent',
host: 'https://minipc:8006',
+ hostAliases: ['minipc', '192.168.0.11'],
coverageLabels: ['Host telemetry'],
statusLabel: 'Active',
primary: false,
diff --git a/frontend-modern/src/components/Settings/connectionsTableModel.ts b/frontend-modern/src/components/Settings/connectionsTableModel.ts
index 6d0875d776..c94ca0ab4a 100644
--- a/frontend-modern/src/components/Settings/connectionsTableModel.ts
+++ b/frontend-modern/src/components/Settings/connectionsTableModel.ts
@@ -132,6 +132,7 @@ export interface InfrastructureSystemMemberRow {
subtitle: string;
source: InfrastructureSourceKind;
host?: string;
+ hostAliases?: string[];
coverageLabels: string[];
statusLabel: string;
statusClassName: string;
@@ -158,6 +159,7 @@ export interface InfrastructureSystemRow {
canPause: boolean;
canRemove: boolean;
isAgent: boolean;
+ isCluster: boolean;
attachedConnections: Connection[];
members: InfrastructureSystemMemberRow[];
connection: Connection;
diff --git a/frontend-modern/src/components/Settings/infrastructureSettingsModel.ts b/frontend-modern/src/components/Settings/infrastructureSettingsModel.ts
index 530b1bda8b..d9deb20218 100644
--- a/frontend-modern/src/components/Settings/infrastructureSettingsModel.ts
+++ b/frontend-modern/src/components/Settings/infrastructureSettingsModel.ts
@@ -1,5 +1,6 @@
import type { ClusterEndpoint, NodeConfig, NodeConfigWithStatus } from '@/types/nodes';
import type { Resource } from '@/types/resource';
+import type { InfrastructureSystemRow } from './connectionsTableModel';
export interface DiscoveredServer {
ip: string;
@@ -20,6 +21,12 @@ export interface DiscoveryScanStatus {
export type NodeType = 'pve' | 'pbs' | 'pmg';
+export interface RepresentedDiscoveryHosts {
+ pve: Set<string>;
+ pbs: Set<string>;
+ pmg: Set<string>;
+}
+
export const matchConfiguredNodeToResource = (
configNode: NodeConfigWithStatus | NodeConfig,
nodeResources: Resource[] | undefined,
@@ -68,3 +75,154 @@ export const collectConfiguredInfrastructureHosts = (nodes: NodeConfigWithStatus
configuredHosts,
};
};
+
+const createRepresentedDiscoveryHosts = (): RepresentedDiscoveryHosts => ({
+ pve: new Set<string>(),
+ pbs: new Set<string>(),
+ pmg: new Set<string>(),
+});
+
+const isNodeType = (value?: string | null): value is NodeType =>
+ value === 'pve' || value === 'pbs' || value === 'pmg';
+
+export const normalizeInfrastructureHost = (value?: string | null): string | null => {
+ const trimmed = value?.trim();
+ if (!trimmed) return null;
+
+ try {
+ const parsed = new URL(trimmed);
+ if (parsed.hostname) {
+ return parsed.hostname.toLowerCase();
+ }
+ } catch {
+ // Fall through to string heuristics below.
+ }
+
+ const withoutScheme = trimmed.replace(/^[a-z]+:\/\//i, '');
+ const withoutPath = withoutScheme.split('/')[0]?.trim() ?? '';
+ if (!withoutPath) return null;
+
+ const bracketedIPv6 = withoutPath.match(/^\[([^\]]+)\](?::\d+)?$/);
+ if (bracketedIPv6?.[1]) {
+ return bracketedIPv6[1].toLowerCase();
+ }
+
+ const hostPortMatch = withoutPath.match(/^(.+):\d+$/);
+ if (hostPortMatch?.[1] && !hostPortMatch[1].includes(':')) {
+ return hostPortMatch[1].toLowerCase();
+ }
+
+ return withoutPath.toLowerCase();
+};
+
+const addRepresentedDiscoveryHost = (
+ representedHosts: RepresentedDiscoveryHosts,
+ type: string | null | undefined,
+ value?: string | null,
+) => {
+ if (!isNodeType(type)) return;
+ const normalized = normalizeInfrastructureHost(value);
+ if (!normalized) return;
+ representedHosts[type].add(normalized);
+};
+
+const addRepresentedDiscoveryHosts = (
+ representedHosts: RepresentedDiscoveryHosts,
+ type: string | null | undefined,
+ values: readonly (string | null | undefined)[],
+) => {
+ values.forEach((value) => addRepresentedDiscoveryHost(representedHosts, type, value));
+};
+
+const addClusterEndpointHosts = (
+ representedHosts: RepresentedDiscoveryHosts,
+ type: 'pve',
+ endpoints: readonly ClusterEndpoint[] | undefined,
+) => {
+ endpoints?.forEach((endpoint) => {
+ addRepresentedDiscoveryHosts(representedHosts, type, [
+ endpoint.ip,
+ endpoint.host,
+ endpoint.guestURL,
+ endpoint.nodeName,
+ endpoint.nodeId,
+ ]);
+ });
+};
+
+const addRowDiscoveryHosts = (
+ representedHosts: RepresentedDiscoveryHosts,
+ row: InfrastructureSystemRow,
+) => {
+ if (row.ownerType !== 'pve' && row.ownerType !== 'pbs' && row.ownerType !== 'pmg') {
+ return;
+ }
+
+ const type = row.ownerType;
+ addRepresentedDiscoveryHosts(representedHosts, type, [
+ row.name,
+ row.host,
+ row.connection.name,
+ row.connection.address,
+ ...(row.connection.hostAliases ?? []),
+ ]);
+
+ row.attachedConnections.forEach((connection) => {
+ addRepresentedDiscoveryHosts(representedHosts, type, [
+ connection.name,
+ connection.address,
+ ...(connection.hostAliases ?? []),
+ ]);
+ });
+
+ row.members.forEach((member) => {
+ addRepresentedDiscoveryHosts(representedHosts, type, [
+ member.name,
+ member.host,
+ ...(member.hostAliases ?? []),
+ member.agentConnection?.name,
+ member.agentConnection?.address,
+ ...(member.agentConnection?.hostAliases ?? []),
+ ]);
+ });
+};
+
+export const collectRepresentedDiscoveryHosts = (
+ nodes: readonly NodeConfigWithStatus[],
+ rows: readonly InfrastructureSystemRow[] = [],
+): RepresentedDiscoveryHosts => {
+ const representedHosts = createRepresentedDiscoveryHosts();
+
+ nodes.forEach((node) => {
+ addRepresentedDiscoveryHosts(representedHosts, node.type, [node.name, node.host, node.guestURL]);
+ if (node.type === 'pve' && 'clusterEndpoints' in node) {
+ addClusterEndpointHosts(representedHosts, node.type, node.clusterEndpoints);
+ }
+ });
+
+ rows.forEach((row) => addRowDiscoveryHosts(representedHosts, row));
+
+ return representedHosts;
+};
+
+export const filterRepresentedDiscoveredServers = (
+ servers: readonly DiscoveredServer[],
+ nodes: readonly NodeConfigWithStatus[],
+ rows: readonly InfrastructureSystemRow[] = [],
+): DiscoveredServer[] => {
+ const representedHosts = collectRepresentedDiscoveryHosts(nodes, rows);
+ return servers.filter((server) => {
+ const represented = representedHosts[server.type];
+ const normalizedIP = normalizeInfrastructureHost(server.ip);
+ if (normalizedIP && represented.has(normalizedIP)) {
+ return false;
+ }
+
+ const normalizedHostname = normalizeInfrastructureHost(server.hostname);
+ if (normalizedHostname && represented.has(normalizedHostname)) {
+ return false;
+ }
+
+ return true;
+ });
+};
diff --git a/frontend-modern/src/components/Settings/useConnectionsLedger.ts b/frontend-modern/src/components/Settings/useConnectionsLedger.ts
index b7c94b13ea..982c4ede44 100644
--- a/frontend-modern/src/components/Settings/useConnectionsLedger.ts
+++ b/frontend-modern/src/components/Settings/useConnectionsLedger.ts
@@ -142,12 +142,32 @@ const moreSevereState = (
return CONNECTION_STATE_SEVERITY[right] > CONNECTION_STATE_SEVERITY[left] ? right : left;
};
+const oldestTimestamp = (
+ values: ReadonlyArray<string | null | undefined>,
+): string | undefined => {
+ let oldestMs: number | undefined;
+ let oldestRaw: string | undefined;
+ for (const value of values) {
+ if (!value) continue;
+ const ms = Date.parse(value);
+ if (Number.isNaN(ms)) continue;
+ if (oldestMs === undefined || ms < oldestMs) {
+ oldestMs = ms;
+ oldestRaw = value;
+ }
+ }
+ return oldestRaw;
+};
+
+interface ClusterRollup {
+ state: ConnectionState;
+ lastSeen?: string;
+}
+
const memberSubtitleFor = (member: ConnectionSystemMember): string =>
- member.primary ? 'Primary cluster node' : 'Cluster member';
+ member.primary ? 'API contact' : 'Cluster member';
const buildMemberRow = (
- ownerType: ConnectionType,
- primaryConnection: Connection,
member: ConnectionSystemMember,
connectionsByID: Map<string, Connection>,
): InfrastructureSystemMemberRow | null => {
@@ -157,15 +177,7 @@ const buildMemberRow = (
const agentConnection = member.agentConnectionId
? connectionsByID.get(member.agentConnectionId)
: undefined;
- const memberConnections = PLATFORM_API_TYPES.has(ownerType)
- ? [primaryConnection, ...(agentConnection ? [agentConnection] : [])]
- : agentConnection
- ? [agentConnection]
- : [];
- const source =
- memberConnections.length > 0
- ? sourceFor(memberConnections)
- : ('unknown' as InfrastructureSourceKind);
+ const source: InfrastructureSourceKind = agentConnection ? 'agent' : 'unknown';
const state = moreSevereState(member.state, agentConnection?.state);
const presentation = STATE_PRESENTATION[state] ?? STATE_PRESENTATION.pending;
const lastSeen =
@@ -179,6 +191,7 @@ const buildMemberRow = (
subtitle: memberSubtitleFor(member),
source,
host: member.endpoint?.trim() || undefined,
+ hostAliases: member.hostAliases?.filter((alias) => alias.trim().length > 0) ?? [],
coverageLabels: agentConnection ? coverageLabelsFor([agentConnection]) : [],
statusLabel: presentation.label,
statusClassName: presentation.badgeClass,
@@ -194,15 +207,19 @@ const buildRow = (
componentConnections: readonly Connection[],
system?: ConnectionSystem | null,
members: InfrastructureSystemMemberRow[] = [],
+ rollup?: ClusterRollup,
): InfrastructureSystemRow => {
- const presentation = STATE_PRESENTATION[primaryConnection.state] ?? STATE_PRESENTATION.pending;
+ const rolledState = rollup?.state ?? primaryConnection.state;
+ const presentation = STATE_PRESENTATION[rolledState] ?? STATE_PRESENTATION.pending;
const clusterName = system?.clusterName?.trim();
+ const isCluster = ownerType === 'pve' && Boolean(clusterName) && members.length > 0;
const name =
ownerType === 'pve' && clusterName
? clusterName
: primaryConnection.name || primaryConnection.address || primaryConnection.id;
- const host =
- primaryConnection.address && primaryConnection.address !== name
+ const host = isCluster
+ ? undefined
+ : primaryConnection.address && primaryConnection.address !== name
? primaryConnection.address
: undefined;
const attachedConnections = componentConnections.filter(
@@ -211,25 +228,36 @@ const buildRow = (
const lastErrorMessage =
primaryConnection.lastError?.message ??
attachedConnections.find((connection) => connection.lastError?.message)?.lastError?.message;
+ const hostTelemetryLabel = surfaceLabel('host');
+ const coverageLabels = isCluster
+ ? coverageLabelsFor(componentConnections).filter((label) => label !== hostTelemetryLabel)
+ : coverageLabelsFor(componentConnections);
+ const source: InfrastructureSourceKind = isCluster ? 'api' : sourceFor(componentConnections);
+ const subtitle = isCluster
+ ? `Cluster · ${members.length} ${members.length === 1 ? 'node' : 'nodes'}`
+ : subtitleFor(componentConnections, primaryConnection);
return {
id: primaryConnection.id,
ownerType,
name,
- subtitle: subtitleFor(componentConnections, primaryConnection),
- source: sourceFor(componentConnections),
+ subtitle,
+ source,
host,
- coverageLabels: coverageLabelsFor(componentConnections),
+ coverageLabels,
statusLabel: presentation.label,
statusClassName: presentation.badgeClass,
agentUpdateCount: agentUpdateCountFor(componentConnections),
- lastActivityText: connectionLastActivityText(primaryConnection),
+ lastActivityText: rollup
+ ? lastActivityTextFromLastSeen(rollup.lastSeen)
+ : connectionLastActivityText(primaryConnection),
lastErrorMessage,
enabled: primaryConnection.enabled,
canEdit: EDITABLE_CONNECTION_TYPES.includes(primaryConnection.type),
canPause: primaryConnection.capabilities.supportsPause,
canRemove: primaryConnection.type !== 'docker' && primaryConnection.type !== 'kubernetes',
isAgent: primaryConnection.type === 'agent',
+ isCluster,
attachedConnections,
members,
connection: primaryConnection,
@@ -254,11 +282,38 @@ const systemToRow = (
componentConnections.push(primaryConnection);
}
- const members = (system.members ?? [])
- .map((member) => buildMemberRow(system.type, primaryConnection, member, connectionsByID))
+ const rawMembers = system.members ?? [];
+ const members = rawMembers
+ .map((member) => buildMemberRow(member, connectionsByID))
.filter((member): member is InfrastructureSystemMemberRow => Boolean(member));
- return buildRow(system.type, primaryConnection, componentConnections, system, members);
+ const isCluster =
+ system.type === 'pve' && Boolean(system.clusterName?.trim()) && members.length > 0;
+ let rollup: ClusterRollup | undefined;
+ if (isCluster) {
+ const memberAgents = rawMembers
+ .map((member) =>
+ member.agentConnectionId ? connectionsByID.get(member.agentConnectionId) : undefined,
+ )
+ .filter((connection): connection is Connection => Boolean(connection));
+ const states: ConnectionState[] = [
+ primaryConnection.state,
+ ...rawMembers.map((member) => member.state),
+ ...memberAgents.map((connection) => connection.state),
+ ];
+ const worstState = states.reduce<ConnectionState>(
+ (acc, state) => moreSevereState(acc, state),
+ 'active',
+ );
+ const lastSeens: Array<string | null | undefined> = [
+ primaryConnection.lastSeen,
+ ...rawMembers.map((member) => member.lastSeen),
+ ...memberAgents.map((connection) => connection.lastSeen),
+ ];
+ rollup = { state: worstState, lastSeen: oldestTimestamp(lastSeens) };
+ }
+
+ return buildRow(system.type, primaryConnection, componentConnections, system, members, rollup);
};
export interface ConnectionsLedger {
diff --git a/frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts b/frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts
index 70dd6989d1..ac78df8166 100644
--- a/frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts
+++ b/frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts
@@ -5,7 +5,7 @@ import { SettingsAPI } from '@/api/settings';
import type { EventDataMap, EventType } from '@/stores/events';
import type { NodeConfigWithStatus } from '@/types/nodes';
import {
- collectConfiguredInfrastructureHosts,
+ filterRepresentedDiscoveredServers,
type DiscoveryScanStatus,
type DiscoveredServer,
} from './infrastructureSettingsModel';
@@ -102,7 +102,6 @@ export const useInfrastructureDiscoveryRuntimeState = ({
return;
}
- const { configuredHosts, clusterMemberIPs } = collectConfiguredInfrastructureHosts(nodes());
const recognizedTypes = ['pve', 'pbs', 'pmg'] as const;
type RecognizedType = (typeof recognizedTypes)[number];
const isRecognizedType = (value: string): value is RecognizedType =>
@@ -142,26 +141,7 @@ export const useInfrastructureDiscoveryRuntimeState = ({
})
.filter((server): server is DiscoveredServer => server !== null);
- const filtered = normalized.filter((server) => {
- const serverIP = server.ip.toLowerCase();
- const serverHostname = server.hostname?.toLowerCase();
-
- if (
- configuredHosts.has(serverIP) ||
- (serverHostname && configuredHosts.has(serverHostname))
- ) {
- return false;
- }
-
- if (
- clusterMemberIPs.has(serverIP) ||
- (serverHostname && clusterMemberIPs.has(serverHostname))
- ) {
- return false;
- }
-
- return true;
- });
+ const filtered = filterRepresentedDiscoveredServers(normalized, nodes());
if (merge) {
setDiscoveredNodes((previous) => {
diff --git a/internal/api/connections_aggregator.go b/internal/api/connections_aggregator.go
index 8aaa07674b..27abfeb462 100644
--- a/internal/api/connections_aggregator.go
+++ b/internal/api/connections_aggregator.go
@@ -98,6 +98,7 @@ func buildPVEConnection(inst config.PVEInstance, health map[string]monitoring.In
Type: ConnectionTypePVE,
Name: inst.Name,
Address: inst.Host,
+ HostAliases: appendNormalizedHosts(nil, inst.Name, inst.Host),
State: state,
StateReason: reason,
Enabled: enabled,
@@ -128,6 +129,7 @@ func buildPBSConnection(inst config.PBSInstance, health map[string]monitoring.In
Type: ConnectionTypePBS,
Name: inst.Name,
Address: inst.Host,
+ HostAliases: appendNormalizedHosts(nil, inst.Name, inst.Host),
State: state,
StateReason: reason,
Enabled: enabled,
@@ -156,6 +158,7 @@ func buildPMGConnection(inst config.PMGInstance, health map[string]monitoring.In
Type: ConnectionTypePMG,
Name: inst.Name,
Address: inst.Host,
+ HostAliases: appendNormalizedHosts(nil, inst.Name, inst.Host),
State: state,
StateReason: reason,
Enabled: enabled,
@@ -187,6 +190,7 @@ func buildVMwareConnection(inst config.VMwareVCenterInstance, health map[string]
Type: ConnectionTypeVMware,
Name: inst.Name,
Address: fmt.Sprintf("https://%s:%d", inst.Host, port),
+ HostAliases: appendNormalizedHosts(nil, inst.Name, inst.Host),
State: state,
StateReason: reason,
Enabled: enabled,
@@ -226,6 +230,7 @@ func buildTrueNASConnection(inst config.TrueNASInstance, health map[string]monit
Type: ConnectionTypeTrueNAS,
Name: inst.Name,
Address: fmt.Sprintf("%s://%s:%d", scheme, inst.Host, port),
+ HostAliases: appendNormalizedHosts(nil, inst.Name, inst.Host),
State: state,
StateReason: reason,
Enabled: enabled,
@@ -283,6 +288,7 @@ func buildAgentConnection(host models.Host, expectedAgentVersion string, now tim
Type: ConnectionTypeAgent,
Name: name,
Address: address,
+ HostAliases: connectionHostAliasesForAgent(host, name, address),
State: state,
StateReason: reason,
Enabled: true,
@@ -298,6 +304,14 @@ func buildAgentConnection(host models.Host, expectedAgentVersion string, now tim
}
}
+func connectionHostAliasesForAgent(host models.Host, name, address string) []string {
+ values := []string{name, address, host.Hostname, host.ReportIP}
+ for _, iface := range host.NetworkInterfaces {
+ values = append(values, iface.Addresses...)
+ }
+ return appendNormalizedHosts(nil, values...)
+}
+
// deriveConnectionState maps (Enabled, InstanceHealth) onto the unified state
// vocabulary. No new state is persisted — the inputs come from the existing
// monitoring scheduler.
diff --git a/internal/api/connections_aggregator_test.go b/internal/api/connections_aggregator_test.go
index c26c241dfd..68e9fd1158 100644
--- a/internal/api/connections_aggregator_test.go
+++ b/internal/api/connections_aggregator_test.go
@@ -1,6 +1,7 @@
package api
import (
+ "reflect"
"testing"
"time"
@@ -164,6 +165,34 @@ func TestBuildConnections_AgentStateFromLastSeen(t *testing.T) {
}
}
+func TestBuildConnections_AgentHostAliasesIncludeReportedIdentityHints(t *testing.T) {
+ now := time.Now()
+ in := aggregatorInputs{
+ hosts: []models.Host{
+ {
+ ID: "pi",
+ Hostname: "pi",
+ ReportIP: "192.168.0.2",
+ LastSeen: now,
+ AgentVersion: "6.0.0",
+ NetworkInterfaces: []models.HostNetworkInterface{
+ {Name: "eth0", Addresses: []string{"192.168.0.2/24", "fe80::1/64"}},
+ },
+ },
+ },
+ expectedAgentVersion: "6.0.1",
+ now: now,
+ }
+
+ got := buildConnections(in)
+ if len(got) != 1 {
+ t.Fatalf("expected 1 connection, got %d", len(got))
+ }
+ if !reflect.DeepEqual(got[0].HostAliases, []string{"pi", "192.168.0.2", "fe80::1"}) {
+ t.Fatalf("agent host aliases = %+v, want %+v", got[0].HostAliases, []string{"pi", "192.168.0.2", "fe80::1"})
+ }
+}
+
func TestBuildConnections_AgentVersionUpdateAvailability(t *testing.T) {
now := time.Now()
in := aggregatorInputs{
diff --git a/internal/api/connections_grouping.go b/internal/api/connections_grouping.go
index 3133dba9ee..062f62c708 100644
--- a/internal/api/connections_grouping.go
+++ b/internal/api/connections_grouping.go
@@ -233,6 +233,7 @@ func connectionSystemMemberFromNode(
ID: strings.TrimSpace(node.ID),
Name: firstNonEmptyTrimmed(node.DisplayName, node.Name),
Endpoint: strings.TrimSpace(node.Host),
+ HostAliases: connectionSystemMemberHostAliasesFromNode(node),
State: connectionSystemMemberStateFromNode(node),
LastSeen: lastSeen,
Primary: isPrimaryProxmoxSystemMember(primary, node.Name, node.Host),
@@ -273,6 +274,7 @@ func connectionSystemMemberFromResource(
ID: strings.TrimSpace(resource.ID),
Name: firstNonEmptyTrimmed(resource.Name, nodeName),
Endpoint: strings.TrimSpace(resource.Proxmox.HostURL),
+ HostAliases: connectionSystemMemberHostAliasesFromResource(resource),
State: connectionSystemMemberStateFromResource(resource),
LastSeen: lastSeen,
Primary: isPrimaryProxmoxSystemMember(primary, nodeName, resource.Proxmox.HostURL),
@@ -306,9 +308,35 @@ func mergeConnectionSystemMembers(
if strings.TrimSpace(existing.AgentConnectionID) == "" {
existing.AgentConnectionID = candidate.AgentConnectionID
}
+ existing.HostAliases = appendNormalizedHosts(existing.HostAliases, candidate.HostAliases...)
return existing
}
+func connectionSystemMemberHostAliasesFromNode(node models.Node) []string {
+ return appendNormalizedHosts(
+ nil,
+ node.Name,
+ node.DisplayName,
+ node.Host,
+ )
+}
+
+func connectionSystemMemberHostAliasesFromResource(resource unified.Resource) []string {
+ values := []string{
+ resource.Name,
+ canonicalResourceHostname(resource),
+ }
+ if resource.Proxmox != nil {
+ values = append(values, resource.Proxmox.NodeName, resource.Proxmox.HostURL)
+ }
+ if resource.Agent != nil {
+ values = append(values, resource.Agent.Hostname)
+ }
+ values = append(values, resource.Identity.Hostnames...)
+ values = append(values, resource.Identity.IPAddresses...)
+ return appendNormalizedHosts(nil, values...)
+}
+
func connectionSystemMemberKey(member ConnectionSystemMember) string {
for _, candidate := range []string{
strings.TrimSpace(member.Name),
@@ -676,6 +704,10 @@ func normalizeHost(raw string) string {
value = host
}
+ if parsedIP, _, err := net.ParseCIDR(value); err == nil && parsedIP != nil {
+ return parsedIP.String()
+ }
+
if parsedIP := net.ParseIP(value); parsedIP != nil {
return parsedIP.String()
}
@@ -692,6 +724,34 @@ func canonicalResourceHostname(resource unified.Resource) string {
return strings.TrimSpace(resource.Canonical.Hostname)
}
+func appendNormalizedHosts(existing []string, candidates ...string) []string {
+ seen := make(map[string]struct{}, len(existing)+len(candidates))
+ out := make([]string, 0, len(existing)+len(candidates))
+ for _, value := range existing {
+ normalized := normalizeHost(value)
+ if normalized == "" {
+ continue
+ }
+ if _, ok := seen[normalized]; ok {
+ continue
+ }
+ seen[normalized] = struct{}{}
+ out = append(out, normalized)
+ }
+ for _, candidate := range candidates {
+ normalized := normalizeHost(candidate)
+ if normalized == "" {
+ continue
+ }
+ if _, ok := seen[normalized]; ok {
+ continue
+ }
+ seen[normalized] = struct{}{}
+ out = append(out, normalized)
+ }
+ return out
+}
+
func connectionTypePriority(typ ConnectionType) int {
switch typ {
case ConnectionTypePVE:
diff --git a/internal/api/connections_grouping_test.go b/internal/api/connections_grouping_test.go
index 9ae48b9076..0ab7a0d285 100644
--- a/internal/api/connections_grouping_test.go
+++ b/internal/api/connections_grouping_test.go
@@ -1,6 +1,7 @@
package api
import (
+ "reflect"
"testing"
"time"
@@ -121,8 +122,9 @@ func TestBuildConnectionSystems_ClusterMemberAgentsAttachToOwningProxmoxSystem(t
LastSeen: now,
Sources: []unified.DataSource{unified.SourceProxmox, unified.SourceAgent},
Identity: unified.ResourceIdentity{
- MachineID: "machine-delly",
- Hostnames: []string{"delly"},
+ MachineID: "machine-delly",
+ Hostnames: []string{"delly"},
+ IPAddresses: []string{"192.168.0.10"},
},
Proxmox: &unified.ProxmoxData{
Instance: "delly",
@@ -150,8 +152,9 @@ func TestBuildConnectionSystems_ClusterMemberAgentsAttachToOwningProxmoxSystem(t
LastSeen: now,
Sources: []unified.DataSource{unified.SourceProxmox, unified.SourceAgent},
Identity: unified.ResourceIdentity{
- MachineID: "machine-minipc",
- Hostnames: []string{"minipc"},
+ MachineID: "machine-minipc",
+ Hostnames: []string{"minipc"},
+ IPAddresses: []string{"192.168.0.11"},
},
Proxmox: &unified.ProxmoxData{
Instance: "delly",
@@ -264,6 +267,9 @@ func TestBuildConnectionSystems_ClusterMemberAgentsAttachToOwningProxmoxSystem(t
if dellyMember.Endpoint != "https://delly:8006" {
t.Fatalf("delly endpoint = %q, want %q", dellyMember.Endpoint, "https://delly:8006")
}
+ if !reflect.DeepEqual(dellyMember.HostAliases, []string{"delly", "192.168.0.10"}) {
+ t.Fatalf("delly host aliases = %+v, want %+v", dellyMember.HostAliases, []string{"delly", "192.168.0.10"})
+ }
if dellyMember.AgentConnectionID != "agent:agent-delly" {
t.Fatalf("delly agent connection = %q, want %q", dellyMember.AgentConnectionID, "agent:agent-delly")
}
@@ -281,6 +287,9 @@ func TestBuildConnectionSystems_ClusterMemberAgentsAttachToOwningProxmoxSystem(t
if minipcMember.Endpoint != "https://minipc:8006" {
t.Fatalf("minipc endpoint = %q, want %q", minipcMember.Endpoint, "https://minipc:8006")
}
+ if !reflect.DeepEqual(minipcMember.HostAliases, []string{"minipc", "192.168.0.11"}) {
+ t.Fatalf("minipc host aliases = %+v, want %+v", minipcMember.HostAliases, []string{"minipc", "192.168.0.11"})
+ }
if minipcMember.AgentConnectionID != "agent:agent-minipc" {
t.Fatalf("minipc agent connection = %q, want %q", minipcMember.AgentConnectionID, "agent:agent-minipc")
}
diff --git a/internal/api/connections_types.go b/internal/api/connections_types.go
index 88a76a582e..0f4d200f31 100644
--- a/internal/api/connections_types.go
+++ b/internal/api/connections_types.go
@@ -67,6 +67,7 @@ type Connection struct {
Type ConnectionType `json:"type"`
Name string `json:"name"`
Address string `json:"address"`
+ HostAliases []string `json:"hostAliases,omitempty"`
State ConnectionState `json:"state"`
StateReason string `json:"stateReason,omitempty"`
Enabled bool `json:"enabled"`
@@ -104,6 +105,7 @@ type ConnectionSystemMember struct {
ID string `json:"id"`
Name string `json:"name"`
Endpoint string `json:"endpoint,omitempty"`
+ HostAliases []string `json:"hostAliases,omitempty"`
State ConnectionState `json:"state"`
LastSeen *time.Time `json:"lastSeen,omitempty"`
Primary bool `json:"primary,omitempty"`
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 9dd19aa5d7..019304e29e 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -11522,17 +11522,19 @@ func TestContract_ConnectionSystemMembersPayloadShapeStaysCanonical(t *testing.T
ID: "node-lab",
Name: "lab",
Endpoint: "https://lab:8006",
+ HostAliases: []string{"lab", "192.168.0.2"},
State: ConnectionStateActive,
LastSeen: timePtr(time.Date(2026, 4, 23, 12, 0, 0, 0, time.UTC)),
Primary: true,
AgentConnectionID: "agent:agent-lab",
},
{
- ID: "node-minipc",
- Name: "minipc",
- Endpoint: "https://minipc:8006",
- State: ConnectionStateStale,
- LastSeen: timePtr(time.Date(2026, 4, 23, 11, 55, 0, 0, time.UTC)),
+ ID: "node-minipc",
+ Name: "minipc",
+ Endpoint: "https://minipc:8006",
+ HostAliases: []string{"minipc"},
+ State: ConnectionStateStale,
+ LastSeen: timePtr(time.Date(2026, 4, 23, 11, 55, 0, 0, time.UTC)),
},
},
}
@@ -11542,7 +11544,7 @@ func TestContract_ConnectionSystemMembersPayloadShapeStaysCanonical(t *testing.T
t.Fatalf("marshal ConnectionSystem with members: %v", err)
}
- want := `{"id":"pve-lab","type":"pve","clusterName":"homelab","components":[{"connectionId":"pve-lab","type":"pve","role":"primary"},{"connectionId":"agent:agent-lab","type":"agent","role":"attachment"}],"members":[{"id":"node-lab","name":"lab","endpoint":"https://lab:8006","state":"active","lastSeen":"2026-04-23T12:00:00Z","primary":true,"agentConnectionId":"agent:agent-lab"},{"id":"node-minipc","name":"minipc","endpoint":"https://minipc:8006","state":"stale","lastSeen":"2026-04-23T11:55:00Z"}]}`
+ want := `{"id":"pve-lab","type":"pve","clusterName":"homelab","components":[{"connectionId":"pve-lab","type":"pve","role":"primary"},{"connectionId":"agent:agent-lab","type":"agent","role":"attachment"}],"members":[{"id":"node-lab","name":"lab","endpoint":"https://lab:8006","hostAliases":["lab","192.168.0.2"],"state":"active","lastSeen":"2026-04-23T12:00:00Z","primary":true,"agentConnectionId":"agent:agent-lab"},{"id":"node-minipc","name":"minipc","endpoint":"https://minipc:8006","hostAliases":["minipc"],"state":"stale","lastSeen":"2026-04-23T11:55:00Z"}]}`
assertJSONSnapshot(t, body, want)
}
@@ -11552,6 +11554,7 @@ func TestContract_AgentConnectionPayloadIncludesVersionFields(t *testing.T) {
Type: ConnectionTypeAgent,
Name: "host-1",
Address: "host-1",
+ HostAliases: []string{"host-1", "192.168.0.2"},
State: ConnectionStateActive,
Enabled: true,
Surfaces: []string{"host"},
@@ -11573,7 +11576,7 @@ func TestContract_AgentConnectionPayloadIncludesVersionFields(t *testing.T) {
t.Fatalf("marshal agent Connection: %v", err)
}
- want := `{"id":"agent:host-1","type":"agent","name":"host-1","address":"host-1","state":"active","enabled":true,"surfaces":["host"],"scope":{"host":true},"lastSeen":"2026-04-22T12:00:00Z","source":"agent","agentVersion":"6.0.0","expectedAgentVersion":"6.0.2","agentUpdateAvailable":true,"capabilities":{"supportsPause":false,"supportsScope":false,"supportsTest":false}}`
+ want := `{"id":"agent:host-1","type":"agent","name":"host-1","address":"host-1","hostAliases":["host-1","192.168.0.2"],"state":"active","enabled":true,"surfaces":["host"],"scope":{"host":true},"lastSeen":"2026-04-22T12:00:00Z","source":"agent","agentVersion":"6.0.0","expectedAgentVersion":"6.0.2","agentUpdateAvailable":true,"capabilities":{"supportsPause":false,"supportsScope":false,"supportsTest":false}}`
assertJSONSnapshot(t, body, want)
}