Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Add vSphere stale guest agent notice
rcourtmane52df68d3070
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex d779777194..f304ec5bbb 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -238,7 +238,10 @@ platform page. These notices must compare against the API-ownedbuilds can show their dirty server version without implying agents can orshould update toward that build. Agentless API-only platforms such as vSpheremust not grow this notice unless a concrete guest or monitored system row-actually carries a Pulse agent identity.+actually carries a Pulse agent identity. On vSphere specifically, stale-agent+copy belongs to correlated in-guest VM agents and must not describe ESXi hosts+as Pulse-agent update targets just because phase-1 host resources use the+canonical `agent` resource type.Kubernetes policy inventory follows that same primitive boundary while theunified-resource owner supplies NetworkPolicy policy type and rule-countcolumns, PodDisruptionBudget budget and observed health columns, ResourceQuotadiff --git a/frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.test.tsx b/frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.test.tsxindex 04f98f82b3..a92bb64dbd 100644--- a/frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.test.tsx+++ b/frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.test.tsx@@ -64,4 +64,27 @@ describe('PlatformOutdatedAgentNotice', () => {'delly is running an older Pulse agent (v5.1.34). Update it to v6.0.0-rc.6 for the latest agent-contributed platform detail on this host.',);});++ it('can describe stale in-guest agents on VMs without host copy', () => {+ render(() => (+ <PlatformOutdatedAgentNotice+ hosts={[+ { name: 'app-01', version: 'v5.1.34' },+ { name: 'db-01', version: 'v5.1.34' },+ ]}+ targetVersion="v6.0.0-rc.6"+ missingLabel="in-guest telemetry and command support"+ copyVariant="latest-detail"+ subjectSingular="VM"+ subjectPlural="VMs"+ />+ ));++ const notice = screen.getByTestId('platform-outdated-agent-notice');+ expect(notice).toHaveTextContent('2 VMs are running an older Pulse agent.');+ expect(notice).toHaveTextContent(+ 'Update them to v6.0.0-rc.6 for the latest in-guest telemetry and command support.',+ );+ expect(notice).toHaveTextContent('Affected: app-01, db-01.');+ });});diff --git a/frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.tsx b/frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.tsxindex aa503a971e..dce0c372f0 100644--- a/frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.tsx+++ b/frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.tsx@@ -3,7 +3,7 @@ import { AlertTriangle, ArrowRight } from 'lucide-solid';import type { OutdatedAgentHost } from './agentVersion';type PlatformOutdatedAgentNoticeProps = {- // Hosts on this page whose agent is behind the server version.+ // Resources on this page whose agent is behind the server version.hosts: OutdatedAgentHost[];// The version users should update to (the server's version). Optional: the// notice still reads sensibly without it.@@ -15,17 +15,21 @@ type PlatformOutdatedAgentNoticeProps = {copyVariant?: 'missing-data' | 'latest-detail';actionHref?: string;actionLabel?: string;+ subjectSingular?: string;+ subjectPlural?: string;};// Inline, self-explaining notice shown on a platform page when one or more of-// its hosts run an agent too old to report part of the page's inventory. It is-// rendered only when there is an actually-outdated host, so the page stays-// clean in the healthy case. This is the breadcrumb that distinguishes a+// its resources run an agent too old to report part of the page's inventory. It+// is rendered only when there is an actually-outdated resource, so the page+// stays clean in the healthy case. This is the breadcrumb that distinguishes a// genuinely-empty detail tab from one hidden by a stale agent.export function PlatformOutdatedAgentNotice(props: PlatformOutdatedAgentNoticeProps) {const count = createMemo(() => props.hosts.length);const names = createMemo(() => props.hosts.map((host) => host.name).join(', '));const actionLabel = createMemo(() => props.actionLabel || 'Open Infrastructure settings');+ const subjectSingular = createMemo(() => props.subjectSingular || 'host');+ const subjectPlural = createMemo(() => props.subjectPlural || 'hosts');const message = createMemo(() => {const target = props.targetVersion ? ` to ${props.targetVersion}` : '';@@ -33,14 +37,14 @@ export function PlatformOutdatedAgentNotice(props: PlatformOutdatedAgentNoticePrif (count() === 1) {const host = props.hosts[0];if (copyVariant === 'latest-detail') {- return `${host.name} is running an older Pulse agent (${host.version}). Update it${target} for the latest ${props.missingLabel} on this host.`;+ return `${host.name} is running an older Pulse agent (${host.version}). Update it${target} for the latest ${props.missingLabel} on this ${subjectSingular()}.`;}- return `${host.name} is running an older Pulse agent (${host.version}). Update it${target} to see ${props.missingLabel} for this host.`;+ return `${host.name} is running an older Pulse agent (${host.version}). Update it${target} to see ${props.missingLabel} for this ${subjectSingular()}.`;}if (copyVariant === 'latest-detail') {- return `${count()} hosts are running an older Pulse agent. Update them${target} for the latest ${props.missingLabel}. Affected: ${names()}.`;+ return `${count()} ${subjectPlural()} are running an older Pulse agent. Update them${target} for the latest ${props.missingLabel}. Affected: ${names()}.`;}- return `${count()} hosts are running an older Pulse agent. Update them${target} to see ${props.missingLabel}. Affected: ${names()}.`;+ return `${count()} ${subjectPlural()} are running an older Pulse agent. Update them${target} to see ${props.missingLabel}. Affected: ${names()}.`;});return (diff --git a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx b/frontend-modern/src/features/vmware/VmwarePageSurface.tsxindex e038ebae50..4d4a64d501 100644--- a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx+++ b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx@@ -1,8 +1,15 @@import { useLocation } from '@solidjs/router';import { Show, createMemo, createResource, type Accessor } from 'solid-js';+import { buildInfrastructureAgentUpdatesPath } from '@/components/Settings/infrastructureWorkspaceModel';import { getPlatformIcon } from '@/features/platformPage/platformIcon';+import { PlatformOutdatedAgentNotice } from '@/features/platformPage/PlatformOutdatedAgentNotice';+import {+ collectOutdatedAgentHosts,+ formatAgentVersionDisplay,+} from '@/features/platformPage/agentVersion';import { ResourceAPI } from '@/api/resources';import { useUnifiedResources } from '@/hooks/useUnifiedResources';+import { updateStore } from '@/stores/updates';import {PlatformErrorState,PlatformSectionTabs,@@ -93,6 +100,18 @@ export function VmwarePageSurface() {const activeTab = createMemo<VmwarePageTabId>(() =>tabs().some((tab) => tab.id === requestedTab()) ? requestedTab() : 'overview',);+ const agentUpdateTargetVersion = createMemo(+ () => updateStore.versionInfo()?.agentUpdateTargetVersion,+ );+ const outdatedAgentVMs = createMemo(() =>+ collectOutdatedAgentHosts(model().vms, agentUpdateTargetVersion()),+ );+ const outdatedAgentUpdatePath = createMemo(() =>+ buildInfrastructureAgentUpdatesPath(outdatedAgentVMs().map((vm) => vm.agentId)),+ );+ const serverVersionDisplay = createMemo(() =>+ formatAgentVersionDisplay(agentUpdateTargetVersion()),+ );// Hosts table on top and the embedded WorkloadsSurface below share the// bars/sparklines toggle (and the sparkline history range that ships with@@ -153,6 +172,16 @@ export function VmwarePageSurface() {/>}>+ <PlatformOutdatedAgentNotice+ hosts={outdatedAgentVMs()}+ targetVersion={serverVersionDisplay()}+ missingLabel="in-guest telemetry and command support"+ copyVariant="latest-detail"+ actionHref={outdatedAgentUpdatePath()}+ actionLabel="Open agent upgrade commands"+ subjectSingular="VM"+ subjectPlural="VMs"+ /><Show when={activeTab() === 'overview'}><VmwareOverviewmodel={model}diff --git a/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx b/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsxnew file mode 100644index 0000000000..21f5fd615a--- /dev/null+++ b/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx@@ -0,0 +1,217 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type { Resource } from '@/types/resource';+import { VmwarePageSurface } from '../VmwarePageSurface';++const mockUseUnifiedResources = vi.fn();+const mockPathname = vi.hoisted(() => vi.fn(() => '/vmware/overview'));+const mockVersionInfo = vi.hoisted(() => vi.fn());+const mockGetGlobalTimeline = vi.hoisted(() => vi.fn());++const makeResource = (resource: Partial<Resource> & Pick<Resource, 'id' | 'type'>): Resource =>+ ({+ name: resource.id,+ displayName: resource.id,+ platformId: 'vmware-1',+ platformType: 'vmware-vsphere',+ sourceType: 'api',+ status: 'online',+ lastSeen: 1_700_000_000_000,+ ...resource,+ }) as Resource;++const setResources = (resources: Resource[]) => {+ mockUseUnifiedResources.mockReturnValue({+ resources: () => resources,+ loading: () => false,+ error: () => null,+ refetch: vi.fn(),+ });+};++vi.mock('@/hooks/useUnifiedResources', () => ({+ useUnifiedResources: (...args: unknown[]) => mockUseUnifiedResources(...args),+}));++vi.mock('@/hooks/usePersistentSignal', () => ({+ usePersistentSignal: (_key: string, initial: unknown) => [() => initial, vi.fn()],+}));++vi.mock('@/stores/updates', () => ({+ updateStore: {+ versionInfo: mockVersionInfo,+ },+}));++vi.mock('@/api/resources', () => ({+ ResourceAPI: {+ getGlobalTimeline: (...args: unknown[]) => mockGetGlobalTimeline(...args),+ },+}));++vi.mock('@solidjs/router', async () => {+ const actual = await vi.importActual<typeof import('@solidjs/router')>('@solidjs/router');+ return {+ ...actual,+ useLocation: () => ({ pathname: mockPathname() }),+ };+});++vi.mock('@/components/Workloads/WorkloadsFilter', () => ({+ WorkloadsFilter: () => <div data-testid="workloads-filter" />,+}));++vi.mock('@/components/Workloads/WorkloadsSurface', () => ({+ WorkloadsSurface: () => <div data-testid="workloads-surface" />,+}));++vi.mock('@/components/Workloads/useWorkloadsState', () => ({+ useWorkloadsState: () => ({+ surfaceConnected: () => false,+ surfaceInitialDataReceived: () => false,+ allGuests: () => [],+ search: () => '',+ setSearch: vi.fn(),+ }),+}));++vi.mock('@/features/platformPage/sharedPlatformPage', () => ({+ PlatformErrorState: () => <div data-testid="platform-error-state" />,+ PlatformSectionTabs: (props: {+ active: string;+ tabs: Array<{ id: string; label: string; path: string }>;+ }) => (+ <div+ data-testid="platform-section-tabs"+ data-active={props.active}+ data-tabs={props.tabs.map((tab) => tab.id).join(',')}+ />+ ),+ PlatformTableEmptyState: () => <div data-testid="platform-table-empty-state" />,+ PlatformTableLoadingState: () => <div data-testid="platform-table-loading-state" />,+}));++vi.mock('../VsphereActivityTable', () => ({+ VsphereActivityTable: () => <div data-testid="activity-table" />,+}));++vi.mock('../VsphereAlertsTable', () => ({+ VsphereAlertsTable: () => <div data-testid="alerts-table" />,+}));++vi.mock('../VsphereDatastoresTable', () => ({+ VsphereDatastoresTable: () => <div data-testid="datastores-table" />,+}));++vi.mock('../VsphereHostsTable', () => ({+ VsphereHostsTable: (props: { hosts: Resource[] }) => (+ <div data-testid="hosts-table" data-rows={props.hosts.length} />+ ),+}));++vi.mock('../VsphereNetworksTable', () => ({+ VsphereNetworksTable: () => <div data-testid="networks-table" />,+}));++describe('VmwarePageSurface contract', () => {+ beforeEach(() => {+ mockPathname.mockReturnValue('/vmware/overview');+ mockVersionInfo.mockReturnValue(null);+ mockGetGlobalTimeline.mockResolvedValue({ recentChanges: [] });+ setResources([]);+ });++ afterEach(() => {+ cleanup();+ vi.clearAllMocks();+ });++ it('surfaces stale in-guest agents on correlated vSphere VMs', () => {+ mockVersionInfo.mockReturnValue({+ version: 'v6.0.0-rc.6',+ agentUpdateTargetVersion: 'v6.0.0-rc.6',+ });+ setResources([+ makeResource({+ id: 'esxi-host-1',+ name: 'esxi-host-1',+ displayName: 'esxi-host-1',+ type: 'agent',+ agent: { osVersion: 'VMware ESXi 8.0.3' },+ vmware: { entityType: 'host', managedObjectId: 'host-1' },+ }),+ makeResource({+ id: 'vm-app-01',+ name: 'app-01',+ displayName: 'app-01',+ type: 'vm',+ agent: { agentId: 'agent-app-01', agentVersion: 'v5.1.34' },+ vmware: { entityType: 'vm', managedObjectId: 'vm-1', runtimeHostName: 'esxi-host-1' },+ }),+ ]);++ render(() => <VmwarePageSurface />);++ expect(screen.getByTestId('platform-section-tabs')).toHaveAttribute('data-active', 'overview');+ expect(screen.getByTestId('hosts-table')).toHaveAttribute('data-rows', '1');+ const notice = screen.getByTestId('platform-outdated-agent-notice');+ expect(notice).toHaveTextContent('app-01 is running an older Pulse agent (v5.1.34).');+ expect(notice).toHaveTextContent(+ 'latest in-guest telemetry and command support on this VM',+ );+ expect(screen.getByRole('link', { name: 'Open agent upgrade commands' })).toHaveAttribute(+ 'href',+ '/settings/infrastructure?agentUpdates=1&agents=agent%3Aagent-app-01',+ );+ });++ it('does not treat vSphere ESXi API host resources as Pulse agent update targets', () => {+ mockVersionInfo.mockReturnValue({+ version: 'v6.0.0-rc.6',+ agentUpdateTargetVersion: 'v6.0.0-rc.6',+ });+ setResources([+ makeResource({+ id: 'esxi-host-1',+ name: 'esxi-host-1',+ displayName: 'esxi-host-1',+ type: 'agent',+ agent: { agentId: 'esxi-host-1', agentVersion: 'v5.1.34', osVersion: 'VMware ESXi 8.0.3' },+ vmware: { entityType: 'host', managedObjectId: 'host-1' },+ }),+ makeResource({+ id: 'vm-app-01',+ name: 'app-01',+ displayName: 'app-01',+ type: 'vm',+ vmware: { entityType: 'vm', managedObjectId: 'vm-1', runtimeHostName: 'esxi-host-1' },+ }),+ ]);++ render(() => <VmwarePageSurface />);++ expect(screen.getByTestId('hosts-table')).toHaveAttribute('data-rows', '1');+ expect(screen.queryByTestId('platform-outdated-agent-notice')).not.toBeInTheDocument();+ });++ it('does not surface stale-agent notices for development builds without an agent target', () => {+ mockVersionInfo.mockReturnValue({+ version: '6.0.0-rc.6+git.172.g2c360f779.dirty',+ isDevelopment: true,+ });+ setResources([+ makeResource({+ id: 'vm-app-01',+ name: 'app-01',+ displayName: 'app-01',+ type: 'vm',+ agent: { agentId: 'agent-app-01', agentVersion: 'v5.1.34' },+ vmware: { entityType: 'vm', managedObjectId: 'vm-1', runtimeHostName: 'esxi-host-1' },+ }),+ ]);++ render(() => <VmwarePageSurface />);++ expect(screen.queryByTestId('platform-outdated-agent-notice')).not.toBeInTheDocument();+ });+});