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.

Add Version + Uptime columns to vSphere Hosts table

rcourtmana57217b194e2
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index d4a7a72d25..0419d39715 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -582,6 +582,16 @@ enrichment issue rather than failing the poll. Mock fixtures
(`internal/mock/platform_fixtures.go`) must synthesize the same fields per
powered-on VM and drop them for powered-off VMs so the demo estate
exercises the same workload-table contract as live vCenter would.
+That same broadcast converter owns the canonical Resource.Uptime
+fallback. `monitorUptime` walks platform-specific carve-outs
+(`Agent.UptimeSeconds`, `Proxmox.Uptime`, `Docker.UptimeSeconds`,
+`Kubernetes.UptimeSeconds`, `PBS.UptimeSeconds`, `PMG.UptimeSeconds`,
+`TrueNAS.UptimeSeconds`) before falling back to `Resource.Uptime`. The
+vSphere adapter populates only the canonical field for ESXi hosts and
+VMs, so without that final fallback the websocket payload would silently
+drop uptime for VMware-backed rows even though the REST contract carries
+it. Carve-outs still take precedence so existing platforms keep their
+prior behavior.
That same poller-owned partial-success model must also keep runtime
observability non-noisy. Repeated polls with the same degraded optional-read
issue classes should not emit a fresh warning every interval; monitoring
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 0506514556..eeb0913e4c 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -736,6 +736,14 @@ a separate Docker-only or TrueNAS-local inventory path.
27. Keep alert-side recovery drill-ins on that same shared route-helper contract. When alert investigation surfaces such as resource-incident panels expose recovery follow-up links for TrueNAS or future API-backed platforms, they must route through the canonical `frontend-modern/src/routing/resourceLinks.ts` recovery builder instead of freezing alert-local recovery URLs or introducing another provider-shaped recovery handoff vocabulary.
28. Keep VMware onboarding runtime and recovery semantics separate on that same adjacent platform-connections contract. When `internal/api/router.go`, `internal/api/router_routes_registration.go`, or `internal/api/vmware_handlers.go` evolve VMware connection CRUD, poller-owned `poll` / `observed` summary payloads, saved-test refresh, or observed datastore/VM snapshot visibility, storage and recovery may consume the resulting shared context but must not treat those onboarding/runtime payloads as canonical recovery artifacts, restore capability, or recovery-local control transport.
29. Keep VMware datastore projection on the shared unified-resource and storage-source contracts. When `frontend-modern/src/hooks/useUnifiedResources.ts` or shared `internal/api/router.go` wiring starts surfacing VMware-backed canonical `storage` resources, storage and recovery may expose those datastores through the owned `vmware-vsphere` source/platform vocabulary for inventory, capacity, and handoff flows only; they must not reinterpret that projection as VMware recovery support, restore semantics, or a provider-local protection surface.
+ The same shared unified-resource boundary also covers canonical
+ Resource.Uptime fallback on the consumer side. When
+ `frontend-modern/src/hooks/useUnifiedResources.ts`'s `toResource`
+ mapping extends the uptime fallback chain to land on `v2.uptime`
+ after the existing platform-specific carve-outs, storage and
+ recovery must treat that fallback as descriptive host/VM uptime
+ only; they must not reinterpret it as backup freshness, recovery
+ point recency, or protection cadence.
30. Keep VMware placement, cluster service state, guest-detail, VM snapshot-tree, VM virtual-hardware configuration, VMware Tools, VM hardware Ethernet, VM hardware disk, and network enrichment descriptive on that same shared unified-resource contract. When `internal/vmware/provider.go`, `internal/unifiedresources/types.go`, and `frontend-modern/src/hooks/useUnifiedResources.ts` project datacenter, cluster, `vmware.clusterHaEnabled`, `vmware.clusterDrsEnabled`, folder, runtime-host, datastore-attachment, guest-hostname, guest-IP, `vmware.currentSnapshotId`, `vmware.snapshotTree`, snapshot creation/state/quiesce/current markers, child snapshot metadata, `vmware.hardware`, virtual hardware version, hardware upgrade policy/version/status/error, boot type/order/retry/setup-mode flags, CPU cores-per-socket and hot-add/remove flags, memory hot-add settings, `vmware.tools`, Tools run state, version status, version number/string, install type, upgrade policy, auto-update support, install-attempt count, guest reboot requests, `vmware.networkAdapters`, adapter MAC address/type, backing network id/name, backing type, connection state, start-connected / guest-control flags, `vmware.virtualDisks`, virtual disk label/type, IDE/SCSI/SATA/NVMe placement, VMDK path, backing type, datastore name, capacity, `vmware.networkType`, `vmware.networkHostNames`, or `vmware.networkVmNames` onto canonical VMware `agent` / `vm` / `storage` / `network` resources, storage and recovery may use that detail for labeling, navigation, and VM investigation context only; they must not promote those topology, cluster-service, guest, snapshot-tree, virtual-hardware, VMware Tools, vNIC, virtual disk, or network fields into recovery ownership, restore targeting, protection grouping, compliance scoring, or a VMware-local recovery taxonomy without a separately governed slice.
31. Keep VMware datastore classification neutral on the shared storage adapter contract. When `frontend-modern/src/features/storageBackups/resourceStorageMapping.ts`, `frontend-modern/src/features/storageBackups/resourceStoragePresentation.ts`, and `frontend-modern/src/features/storageBackups/storageAdapters.ts` evolve canonical storage-record mapping, VMware-backed datastores must continue to land on the shared storage route as inventory-only datastores with neutral protection fallback, not as backup repositories, backup targets, or recovery-protected resources.
That same shared storage adapter boundary also owns canonical platform
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index e343288160..515554fa91 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -671,6 +671,14 @@ AI-only summary payloads, or page-local heuristics.
broader cache already reflects canonical resource truth, and fresh empty
snapshots must remain cacheable instead of regressing route handoffs back
to transient full-page loading shells.
+ That same `toResource` mapping owns canonical-field fallback for the
+ per-resource scalars the frontend reads. `Resource.uptime` must fall
+ back to the canonical `v2.uptime` field after the platform-specific
+ carve-outs (`agent.uptimeSeconds`, `proxmox.uptime`, `pbs.uptimeSeconds`,
+ `pmg.uptimeSeconds`, `kubernetes.uptimeSeconds`). The vSphere adapter
+ populates only the canonical field on the REST contract, so without
+ landing on `v2.uptime` ESXi hosts and VMware-backed VMs lose uptime on
+ the unified-resources side even though the API payload carries it.
That same shared cache boundary must normalize route/query type filters
through the canonical frontend-to-`ResourceType` resolver before slicing
the snapshot, so compatibility values such as `disk` / `physical_disk`
diff --git a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
index 90f583d657..fd4cb2d4d2 100644
--- a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
@@ -14,6 +14,7 @@ import {
} from '@/components/shared/Table';
import { getSimpleStatusIndicator } from '@/utils/status';
import { asTrimmedString } from '@/utils/stringUtils';
+import { formatUptime } from '@/utils/format';
import { formatVmwareClusterServices } from '@/utils/vmwareDisplay';
import {
formatVmwarePowerState,
@@ -142,42 +143,52 @@ export const VsphereHostsTable: Component<{
integer-count columns to what their content actually
needs. Mobile widths are unchanged.
*/}
- <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[18%]`}>
+ <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[16%]`}>
Host
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[11%]`}
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[6%]`}
+ >
+ Version
+ </TableHead>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[10%]`}
>
Datacenter
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[12%]`}
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[10%]`}
>
Cluster
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[9%]`}
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[7%]`}
>
Power
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[13%]`}>
+ <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[12%]`}>
CPU
</TableHead>
<TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[13%]`}>
Memory
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[9%]`}
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[7%]`}
>
Datastores
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[5%]`}
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[4%]`}
>
VMs
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[10%]`}
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[6%]`}
+ >
+ Uptime
+ </TableHead>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[9%]`}
>
vCenter
</TableHead>
@@ -192,6 +203,19 @@ export const VsphereHostsTable: Component<{
const cluster = () => asTrimmedString(meta()?.clusterName) || '—';
const clusterServices = () => formatVmwareClusterServices(meta());
const vcenter = () => asTrimmedString(meta()?.vcenterHost) || '—';
+ // ESXi version from agent.osVersion (canonical projection of
+ // HostSystem.config.product.fullName); uptime from the
+ // sys.uptime.latest PerformanceManager counter routed onto
+ // canonical Resource.Uptime.
+ const esxiVersion = () => asTrimmedString(host.agent?.osVersion) || '—';
+ const uptimeLabel = () =>
+ typeof host.uptime === 'number' && host.uptime > 0
+ ? formatUptime(host.uptime, true)
+ : '—';
+ const uptimeFull = () =>
+ typeof host.uptime === 'number' && host.uptime > 0
+ ? formatUptime(host.uptime)
+ : '';
const datastoreCount = () =>
meta()?.datastoreIds?.length ?? meta()?.datastoreNames?.length ?? 0;
const vmCount = () =>
@@ -232,6 +256,12 @@ export const VsphereHostsTable: Component<{
</span>
</div>
</TableCell>
+ <TableCell
+ class={`${getPlatformTableCellClassForKind('text')} hidden font-mono text-[11px] text-base-content md:table-cell`}
+ title={esxiVersion()}
+ >
+ <span class="block truncate">{esxiVersion()}</span>
+ </TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}
>
@@ -294,6 +324,12 @@ export const VsphereHostsTable: Component<{
>
{vmCount()}
</TableCell>
+ <TableCell
+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell whitespace-nowrap`}
+ title={uptimeFull()}
+ >
+ {uptimeLabel()}
+ </TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('text')} hidden font-mono text-[11px] text-base-content md:table-cell`}
>
@@ -306,7 +342,7 @@ export const VsphereHostsTable: Component<{
resource={host}
open={isExpanded()}
detailRowId={detailRowId()}
- colSpan={9}
+ colSpan={11}
resolveResourceLabel={resolveResourceLabel}
onClose={() => drawer.close(host)}
/>
diff --git a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
index 3988ce478f..1459186bf0 100644
--- a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
@@ -801,6 +801,39 @@ describe('useUnifiedResources', () => {
dispose();
});
+ it('falls back to canonical resource.uptime when no platform-specific field is set (vSphere)', async () => {
+ // vSphere ESXi hosts and VMs populate only the canonical
+ // Resource.Uptime field — there's no vmware-specific UptimeSeconds
+ // carve-out. The toResource mapping must land on v2.uptime so the
+ // unified-resources contract surfaces uptime for VMware-backed rows.
+ apiFetchMock.mockResolvedValueOnce({
+ ok: true,
+ json: async () => ({
+ data: [
+ {
+ ...v2Resource,
+ sources: ['vmware'],
+ agent: undefined,
+ proxmox: undefined,
+ uptime: 9876543,
+ },
+ ],
+ }),
+ });
+
+ let dispose = () => {};
+ let result: ReturnType<UseUnifiedResourcesModule['useUnifiedResources']> | undefined;
+ createRoot((d) => {
+ dispose = d;
+ result = useUnifiedResources({ query: 'type=agent', cacheKey: 'vsphere-host-uptime' });
+ });
+
+ await result!.refetch();
+ expect(result!.resources()[0]?.uptime).toBe(9876543);
+
+ dispose();
+ });
+
it('falls back to proxmox temperature when agent temperature is unavailable', async () => {
apiFetchMock.mockResolvedValueOnce({
ok: true,
diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.ts
index 94734c8c49..0d693a5b37 100644
--- a/frontend-modern/src/hooks/useUnifiedResources.ts
+++ b/frontend-modern/src/hooks/useUnifiedResources.ts
@@ -139,6 +139,7 @@ type APIResource = {
type?: string;
name?: string;
status?: string;
+ uptime?: number;
lastSeen?: string;
parentName?: string;
sources?: string[];
@@ -727,7 +728,13 @@ const toResource = (v2: APIResource): Resource => {
v2.proxmox?.uptime ??
v2.pbs?.uptimeSeconds ??
v2.pmg?.uptimeSeconds ??
- v2.kubernetes?.uptimeSeconds,
+ v2.kubernetes?.uptimeSeconds ??
+ // Canonical Resource.Uptime is the universal fallback — vSphere
+ // adapters populate only this field (no platform-specific carve-out
+ // for hosts/datastores/networks), so the chain has to land here for
+ // ESXi host uptime to surface on the unified-resources side. Same
+ // fallback shape as the workloads mapping in useWorkloads.ts.
+ v2.uptime,
temperature:
v2.agent?.temperature ??
v2.proxmox?.temperature ??
diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.go
index f7060fb215..188cc09c37 100644
--- a/internal/monitoring/canonical_guardrails_test.go
+++ b/internal/monitoring/canonical_guardrails_test.go
@@ -2021,3 +2021,44 @@ func TestPollersHonorDisabledInstanceFlag(t *testing.T) {
}
}
}
+
+// TestMonitorUptimeFallsBackToCanonicalResourceUptime locks the contract
+// that the websocket broadcast converter must surface canonical
+// Resource.Uptime when no platform-specific carve-out is populated. The
+// vSphere adapter writes uptime onto Resource.Uptime only (no
+// vmware-specific UptimeSeconds), so without this fallback WS broadcasts
+// would silently drop uptime for VMware-backed rows even though the
+// canonical REST `/api/resources` payload exposes it.
+func TestMonitorUptimeFallsBackToCanonicalResourceUptime(t *testing.T) {
+ t.Run("falls through to Resource.Uptime when no source carve-out is set", func(t *testing.T) {
+ resource := unifiedresources.Resource{Uptime: 123456}
+ got := monitorUptime(resource)
+ if got == nil || *got != 123456 {
+ t.Fatalf("monitorUptime() = %v, want 123456 from canonical Resource.Uptime", got)
+ }
+ })
+
+ t.Run("agent / proxmox / docker / k8s carve-outs keep precedence", func(t *testing.T) {
+ resource := unifiedresources.Resource{
+ Uptime: 999999,
+ Agent: &unifiedresources.AgentData{UptimeSeconds: 100},
+ }
+ got := monitorUptime(resource)
+ if got == nil || *got != 100 {
+ t.Fatalf("monitorUptime() = %v, want 100 from agent (precedence over canonical Uptime)", got)
+ }
+
+ resource.Agent = nil
+ resource.Proxmox = &unifiedresources.ProxmoxData{Uptime: 200}
+ got = monitorUptime(resource)
+ if got == nil || *got != 200 {
+ t.Fatalf("monitorUptime() = %v, want 200 from proxmox (precedence over canonical Uptime)", got)
+ }
+ })
+
+ t.Run("returns nil when nothing populates", func(t *testing.T) {
+ if got := monitorUptime(unifiedresources.Resource{}); got != nil {
+ t.Fatalf("monitorUptime() = %v, want nil when all sources empty", got)
+ }
+ })
+}
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index 6febadc2fe..e2dcea6415 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -5504,6 +5504,16 @@ func monitorUptime(resource unifiedresources.Resource) *int64 {
value := resource.TrueNAS.UptimeSeconds
return &value
}
+ // Canonical Resource.Uptime is the universal fallback. The vSphere
+ // adapter populates only this field for ESXi hosts and VMs (no
+ // vmware-specific UptimeSeconds carve-out), so without this fall the
+ // websocket broadcast layer would drop uptime for VMware-backed rows
+ // even though the REST `/api/resources` payload exposes it on
+ // `resource.uptime` directly.
+ if resource.Uptime > 0 {
+ value := resource.Uptime
+ return &value
+ }
return nil
}