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.

Color platform table metric bars from configured alert thresholds

[email protected]4ea99183fd3d
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 804035b51e..e62e92d1b6 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -430,13 +430,22 @@ metadata or resource type says storage they must keep using storage threshold
resolution and source-alias overrides instead of node defaults.
Browser metric severity colors are also alert-backed. Workloads,
-Infrastructure, and Storage may pass resolved display thresholds into their
-local bars, but threshold selection must flow through the shared alert activation
+Infrastructure, Storage, and the platform-page tables (Docker hosts and
+containers, Proxmox nodes, Kubernetes clusters and nodes, TrueNAS systems and
+apps, vSphere hosts) may pass resolved display thresholds into their local
+bars, but threshold selection must flow through the shared alert activation
store and `frontend-modern/src/utils/metricThresholds.ts`, including configured
hysteresis, disabled thresholds, storage usage defaults, and guest/Docker
-override identity candidates. Static metric-color defaults are only fallback
-presentation behavior for callers that do not have alert configuration in
-scope.
+override identity candidates. The display resolver mirrors the runtime's
+per-platform default scopes — guest, node, pbs, agent, docker, storage, plus
+kubernetes, truenas, and vmware backed by `kubernetesDefaults`,
+`truenasDefaults`, and `vmwareDefaults` — and unified platform resources
+resolve overrides through the shared
+`unifiedPlatformOverrideIdCandidates` chain in
+`frontend-modern/src/features/alerts/alertOverridesModel.ts` (the same
+candidate set `buildProjectedOverrides` indexes platform alert rows under).
+Static metric-color defaults are only fallback presentation behavior for
+callers that do not have alert configuration in scope.
Docker container image-update alerts are lifecycle-governed by the alerts
runtime. Disabling Docker update alerts globally, disabling alerts for a
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 8d59431a88..147f743f4a 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -3581,6 +3581,15 @@ Standalone, TrueNAS, and vSphere platform tables and their table-model helpers
must compose those helpers instead of declaring local `metricFallback` /
`finiteMetric` helpers or inlining centered muted dash fallback markup in
metric cells.
+Platform table metric severity coloring is alert-backed, not hardcoded. The
+Docker host and container, Proxmox node, Kubernetes cluster and node, TrueNAS
+system and app, and vSphere host tables must resolve display thresholds
+through the alerts subsystem's activation store
+(`getMetricThresholds` with the platform's runtime scope and override
+identity candidates) and pass them into the shared metric bar primitives
+(`ResponsiveMetricCell`, `StackedMemoryBar`, `StackedDiskBar`); the static
+`METRIC_THRESHOLDS` display constants remain fallback-only presentation for
+callers without alert configuration in scope.
Canonical Linux memory usage-unavailable is a first-class metric fallback,
not a numeric zero. Shared workload bars, platform tables, drawers, and live
history labels must render `N/A` (while retaining known capacity where useful)
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 43a1e2597f..703f0b6492 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -337,6 +337,14 @@ Alert decoration on those platform rows consumes the canonical active-alert
read model and the detector-enabled accessor. External notification activation
is not a resource-health field and must never suppress row alerts, change
resource filtering, or create a parallel platform-local alert truth.
+Metric severity coloring on those platform rows is alert-threshold-backed:
+platform tables resolve display thresholds through the alerts activation
+store using the platform's runtime scope (agent for Docker hosts, docker for
+containers, node for Proxmox nodes, kubernetes / truenas / vmware for their
+platform rows) and the resource's override identity candidates (host,
+docker-container, or unified-platform candidate chains) rather than
+platform-local threshold constants, so row bars agree with the alert runtime
+about when a resource is in a warning or critical band.
The standalone Machines monitor keeps resource-specific health on the canonical
table row and resource detail surface rather than duplicating row warnings in a
page-wide posture banner. Its row indicator must use the same canonical resource
diff --git a/frontend-modern/.bundlesize.json b/frontend-modern/.bundlesize.json
index 49fa7508c1..79bd401f61 100644
--- a/frontend-modern/.bundlesize.json
+++ b/frontend-modern/.bundlesize.json
@@ -1,136 +1,133 @@
{
"$comment": "Frontend bundle size baseline. Run 'npm run check:bundlesize' to validate. To update: run 'node scripts/check-bundle-size.mjs --update-baseline' after vite build.",
"version": 1,
- "generated": "2026-07-19",
+ "generated": "2026-07-27",
"defaultThresholdPercent": 15,
"chunks": {
"index": {
- "baselineGzip": 133755
+ "baselineGzip": 136248
},
"sharedPlatformPage": {
- "baselineGzip": 98535
+ "baselineGzip": 104842
},
"Alerts": {
- "baselineGzip": 91158
+ "baselineGzip": 96254
},
"Settings": {
- "baselineGzip": 86127
+ "baselineGzip": 87928
},
"InfrastructureWorkspace": {
- "baselineGzip": 77860
+ "baselineGzip": 85384
},
"Proxmox": {
- "baselineGzip": 68321
+ "baselineGzip": 69453
},
"Chat": {
- "baselineGzip": 67685
+ "baselineGzip": 67797
},
"WorkloadsSurface": {
- "baselineGzip": 53883
+ "baselineGzip": 53812
},
"AIIntelligence": {
- "baselineGzip": 52309
+ "baselineGzip": 53154
},
"Docker": {
- "baselineGzip": 25183
+ "baselineGzip": 25483
},
"vendor-ai": {
- "baselineGzip": 22826
+ "baselineGzip": 23030
},
"Standalone": {
- "baselineGzip": 17923
+ "baselineGzip": 18590
},
"vendor-solid": {
"baselineGzip": 17620
},
"Kubernetes": {
- "baselineGzip": 16467
+ "baselineGzip": 16636
},
"TrueNAS": {
- "baselineGzip": 15774
+ "baselineGzip": 15979
},
"vendor-highlight": {
"baselineGzip": 13743
},
"ReportingPanel": {
- "baselineGzip": 12514
+ "baselineGzip": 12501
},
"vendor-icons": {
- "baselineGzip": 11105
+ "baselineGzip": 11148
},
"vendor": {
"baselineGzip": 9857
},
"Vmware": {
- "baselineGzip": 9716
+ "baselineGzip": 9757
},
"aiControlLevelPresentation": {
- "baselineGzip": 9644
+ "baselineGzip": 9643
},
"UpdatesSettingsPanel": {
- "baselineGzip": 9565
+ "baselineGzip": 9307
},
"messages.de": {
- "baselineGzip": 8937
+ "baselineGzip": 9198
},
"messages.es": {
- "baselineGzip": 8753
+ "baselineGzip": 8991
},
"AuditLogPanel": {
- "baselineGzip": 8537
+ "baselineGzip": 8701
},
"APIAccessPanel": {
- "baselineGzip": 8423
+ "baselineGzip": 8399
},
"DrawerDiskListCard": {
- "baselineGzip": 8043
+ "baselineGzip": 8047
},
"FormTextarea": {
- "baselineGzip": 7336
+ "baselineGzip": 7337
+ },
+ "AvailabilitySettingsPanel": {
+ "baselineGzip": 7240
},
"ActionReviewDialog": {
- "baselineGzip": 6712
+ "baselineGzip": 6711
},
- "AvailabilitySettingsPanel": {
- "baselineGzip": 7250
+ "DiagnosticsPanel": {
+ "baselineGzip": 5840
},
"SecurityAuthPanel": {
- "baselineGzip": 5836
+ "baselineGzip": 5833
},
- "FilterBar": {
- "baselineGzip": 5641
+ "useUnifiedResources": {
+ "baselineGzip": 5790
},
- "DiagnosticsPanel": {
- "baselineGzip": 5567
+ "FilterBar": {
+ "baselineGzip": 5636
},
"SetupWizard": {
- "baselineGzip": 5558
- },
- "useUnifiedResources": {
- "baselineGzip": 5539
+ "baselineGzip": 5532
},
"HelpIcon": {
- "baselineGzip": 5518
- },
- "RelaySettingsPanel": {
- "baselineGzip": 5325
+ "baselineGzip": 5516
},
"truenasPageModel": {
- "baselineGzip": 5292
+ "baselineGzip": 5413
},
- "alertOverridesModel": {
- "baselineGzip": 5236
+ "RelaySettingsPanel": {
+ "baselineGzip": 5295
},
"OrganizationSharingPanel": {
- "baselineGzip": 5185
+ "baselineGzip": 5183
}
},
"totals": {
"js": {
- "baselineGzip": 1159293
+ "baselineGzip": 1182853
},
"css": {
- "baselineGzip": 26579
+ "baselineGzip": 26751
}
}
}
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx
index 0fb67d62b0..68ca174458 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx
@@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest';
import type { Resource } from '@/types/resource';
+import { unifiedPlatformOverrideIdCandidates } from '../alertOverridesModel';
import { useAlertOverridesState } from '../useAlertOverridesState';
const makeResource = (overrides: Partial<Resource>): Resource =>
@@ -272,4 +273,38 @@ describe('useAlertOverridesState', () => {
platformType: 'truenas',
});
});
+
+ it('exposes the unified platform override candidate chain used by display threshold lookups', () => {
+ const resource = makeResource({
+ id: 'k8s:prod:node:worker-01',
+ type: 'k8s-node',
+ platformId: 'prod',
+ canonicalIdentity: {
+ supersededIds: ['k8s:prod-old:node:worker-01'],
+ },
+ metricsTarget: { resourceId: 'metrics:worker-01' },
+ discoveryTarget: { resourceId: 'discovery:worker-01' },
+ } as Partial<Resource>);
+
+ // Candidate precedence matches the buildProjectedOverrides indexing order,
+ // so a stored override binds to the same row the tables color from.
+ expect(unifiedPlatformOverrideIdCandidates(resource)).toEqual([
+ 'k8s:prod:node:worker-01',
+ 'k8s:prod-old:node:worker-01',
+ 'metrics:worker-01',
+ 'discovery:worker-01',
+ 'prod',
+ ]);
+
+ // Duplicates and blank entries collapse instead of producing repeat keys.
+ expect(
+ unifiedPlatformOverrideIdCandidates(
+ makeResource({
+ id: 'truenas-main',
+ type: 'agent',
+ platformId: 'truenas-main',
+ }),
+ ),
+ ).toEqual(['truenas-main']);
+ });
});
diff --git a/frontend-modern/src/features/alerts/alertOverridesModel.ts b/frontend-modern/src/features/alerts/alertOverridesModel.ts
index df138045de..8cc9fc0261 100644
--- a/frontend-modern/src/features/alerts/alertOverridesModel.ts
+++ b/frontend-modern/src/features/alerts/alertOverridesModel.ts
@@ -200,6 +200,18 @@ export const dockerHostOverrideIdCandidates = (resource: Resource): string[] =>
export const dockerContainerOverrideIdCandidates = (host: Resource, shortId: string): string[] =>
uniqueIds(...dockerHostOverrideIdCandidates(host).map((hostId) => `docker:${hostId}/${shortId}`));
+// Kubernetes / TrueNAS / VMware resources are keyed by their unified resource
+// IDs in the overrides map (the same candidates buildProjectedOverrides
+// indexes platform alert rows under).
+export const unifiedPlatformOverrideIdCandidates = (resource: Resource): string[] =>
+ uniqueIds(
+ resource.id,
+ ...(resource.canonicalIdentity?.supersededIds ?? []),
+ resource.metricsTarget?.resourceId,
+ resource.discoveryTarget?.resourceId,
+ resource.platformId,
+ );
+
export const buildContainerRuntimeResources = ({
allResources,
dockerHostResources,
@@ -281,14 +293,7 @@ export const buildProjectedOverrides = ({
overridesList.push(override);
};
- const alertResourceIdCandidates = (resource: Resource): string[] =>
- uniqueIds(
- resource.id,
- ...(resource.canonicalIdentity?.supersededIds ?? []),
- resource.metricsTarget?.resourceId,
- resource.discoveryTarget?.resourceId,
- resource.platformId,
- );
+ const alertResourceIdCandidates = unifiedPlatformOverrideIdCandidates;
const isTrueNASResource = (resource: Resource): boolean =>
isTrueNASSystemResource(resource) ||
diff --git a/frontend-modern/src/features/docker/DockerContainersTable.tsx b/frontend-modern/src/features/docker/DockerContainersTable.tsx
index b650e453e5..e74f952b5c 100644
--- a/frontend-modern/src/features/docker/DockerContainersTable.tsx
+++ b/frontend-modern/src/features/docker/DockerContainersTable.tsx
@@ -22,6 +22,8 @@ import { useBreakpoint } from '@/hooks/useBreakpoint';
import { TableCell, TableRow } from '@/components/shared/Table';
import { asTrimmedString } from '@/utils/stringUtils';
import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
+import { useAlertsActivation } from '@/stores/alertsActivation';
+import { dockerContainerOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';
import { DOCKER_QUERY_PARAMS } from '@/routing/resourceLinks';
import {
PLATFORM_HEALTH_FILTER_OPTIONS,
@@ -262,6 +264,7 @@ const DOCKER_CONTAINER_SEARCH_TIPS = {
};
export const DockerContainersTable: Component<DockerContainersTableProps> = (props) => {
+ const alertsActivation = useAlertsActivation();
const breakpoint = useBreakpoint();
const layoutMode = createMemo(() => getWorkloadTableLayoutMode(breakpoint.width()));
// Search and status live in the URL, like the host scope below, so the
@@ -445,6 +448,18 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro
const host = () => dockerHostName(resource);
const running = () => isContainerRunning(resource);
const metricsKey = () => buildMetricKeyForUnifiedResource(resource);
+ // Overrides are keyed as docker:<hostId>/<shortId>; without the backing
+ // host resource only the docker-scope defaults can apply.
+ const alertResourceIds = () => {
+ const hostResource = hostResourceByName().get(host());
+ if (!hostResource) return [];
+ const shortId = resource.id.includes('/') ? resource.id.split('/').pop()! : resource.id;
+ return dockerContainerOverrideIdCandidates(hostResource, shortId);
+ };
+ const cpuThresholds = () =>
+ alertsActivation.getMetricThresholds('docker', 'cpu', alertResourceIds());
+ const memoryThresholds = () =>
+ alertsActivation.getMetricThresholds('docker', 'memory', alertResourceIds());
const cpuPercent = () => getPlatformTableFiniteMetric(resource.cpu?.current);
const memoryUsed = () => getPlatformTableFiniteMetric(resource.memory?.used) ?? 0;
const memoryTotal = () => getPlatformTableFiniteMetric(resource.memory?.total) ?? 0;
@@ -519,6 +534,7 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro
resourceId={metricsKey()}
isRunning={running() && cpuPercent() !== undefined}
showMobile={false}
+ thresholds={cpuThresholds()}
/>
</TableCell>
);
@@ -533,6 +549,7 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro
used={memoryUsed()}
total={memoryTotal()}
percentOnly={memoryPercentOnly()}
+ thresholds={memoryThresholds()}
/>
</Show>
</TableCell>
diff --git a/frontend-modern/src/features/docker/DockerHostsTable.tsx b/frontend-modern/src/features/docker/DockerHostsTable.tsx
index 320c1dcda6..1d7ddf1610 100644
--- a/frontend-modern/src/features/docker/DockerHostsTable.tsx
+++ b/frontend-modern/src/features/docker/DockerHostsTable.tsx
@@ -10,6 +10,7 @@ import { getSimpleStatusIndicator } from '@/utils/status';
import { getAlertStyles } from '@/utils/alerts';
import { useWebSocket } from '@/contexts/appRuntime';
import { useAlertsActivation } from '@/stores/alertsActivation';
+import { hostOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';
import { asTrimmedString } from '@/utils/stringUtils';
import { normalizeDiskArray } from '@/utils/format';
import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
@@ -338,6 +339,13 @@ export const DockerHostsTable: Component<{
const indicator = () => getSimpleStatusIndicator(host.status);
const canRenderMetrics = () => indicator().variant !== 'danger';
const metricsKey = () => buildMetricKeyForUnifiedResource(host);
+ const alertResourceIds = () => hostOverrideIdCandidates(host);
+ const cpuThresholds = () =>
+ alertsActivation.getMetricThresholds('agent', 'cpu', alertResourceIds());
+ const memoryThresholds = () =>
+ alertsActivation.getMetricThresholds('agent', 'memory', alertResourceIds());
+ const diskThresholds = () =>
+ alertsActivation.getMetricThresholds('agent', 'disk', alertResourceIds());
const cpuPercent = () => percentFromMetric(host.cpu);
const memoryUsed = () => memoryUsedFor(host);
const memoryTotal = () => memoryTotalFor(host);
@@ -448,6 +456,7 @@ export const DockerHostsTable: Component<{
resourceId={metricsKey()}
isRunning={canRenderMetrics() && cpuPercent() !== undefined}
showMobile={false}
+ thresholds={cpuThresholds()}
/>
</TableCell>
<TableCell
@@ -462,6 +471,7 @@ export const DockerHostsTable: Component<{
total={memoryTotal()}
unavailable={memoryUnavailableFor(host)}
percentOnly={memoryPercentOnly()}
+ thresholds={memoryThresholds()}
/>
</Show>
</TableCell>
@@ -476,6 +486,7 @@ export const DockerHostsTable: Component<{
mode={(disks()?.length ?? 0) > 1 ? 'vertical-bars' : undefined}
disks={disks()}
aggregateDisk={aggregateDisk()}
+ thresholds={diskThresholds()}
/>
</Show>
</TableCell>
diff --git a/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
index 4875f34bb2..94c3328b77 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
@@ -3,14 +3,33 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
import type { Disk } from '@/types/api';
import type { Resource } from '@/types/resource';
+import type { MetricDisplayThresholds } from '@/utils/metricThresholds';
import { DockerHostsTable } from '../DockerHostsTable';
+const formatThresholds = (thresholds?: MetricDisplayThresholds | null): string =>
+ thresholds ? `${thresholds.warning}/${thresholds.critical}` : '';
+
+// Row bars must color from the alert-configured thresholds, not the
+// hardcoded METRIC_THRESHOLDS display defaults (memory 75/85), so a host
+// with a raised memory override stops showing red below its alert point.
+const getMetricThresholdsMock = vi.hoisted(() =>
+ vi.fn((_scope: string, metric: string) =>
+ metric === 'memory' ? { warning: 90, critical: 95 } : { warning: 80, critical: 85 },
+ ),
+);
+
vi.mock('@/components/shared/responsive', () => ({
- ResponsiveMetricCell: (props: { type: string; isRunning?: boolean; resourceId?: string }) => (
+ ResponsiveMetricCell: (props: {
+ type: string;
+ isRunning?: boolean;
+ resourceId?: string;
+ thresholds?: MetricDisplayThresholds | null;
+ }) => (
<div
data-testid={`responsive-${props.type}-metric`}
data-resource-id={props.resourceId ?? ''}
data-running={String(props.isRunning)}
+ data-thresholds={formatThresholds(props.thresholds)}
/>
),
}));
@@ -21,7 +40,7 @@ vi.mock('@/contexts/appRuntime', () => ({
vi.mock('@/stores/alertsActivation', () => ({
useAlertsActivation: () => ({
detectionEnabled: () => true,
- getMetricThresholds: () => ({ warning: 80, critical: 85 }),
+ getMetricThresholds: getMetricThresholdsMock,
}),
}));
@@ -31,6 +50,7 @@ vi.mock('@/components/Workloads/StackedMemoryBar', () => ({
total: number;
unavailable?: boolean;
percentOnly?: number;
+ thresholds?: MetricDisplayThresholds | null;
}) => (
<div
data-testid="stacked-memory-bar"
@@ -38,17 +58,24 @@ vi.mock('@/components/Workloads/StackedMemoryBar', () => ({
data-total={String(props.total)}
data-unavailable={String(props.unavailable === true)}
data-percent-only={String(props.percentOnly ?? '')}
+ data-thresholds={formatThresholds(props.thresholds)}
/>
),
}));
vi.mock('@/components/Workloads/StackedDiskBar', () => ({
- StackedDiskBar: (props: { disks?: Disk[]; aggregateDisk?: Disk; mode?: string }) => (
+ StackedDiskBar: (props: {
+ disks?: Disk[];
+ aggregateDisk?: Disk;
+ mode?: string;
+ thresholds?: MetricDisplayThresholds | null;
+ }) => (
<div
data-testid="stacked-disk-bar"
data-mode={props.mode ?? ''}
data-disks={String(props.disks?.length ?? 0)}
data-aggregate-usage={String(props.aggregateDisk?.usage ?? '')}
+ data-thresholds={formatThresholds(props.thresholds)}
/>
),
}));
@@ -115,6 +142,30 @@ describe('DockerHostsTable', () => {
expect(screen.getByTestId('stacked-disk-bar')).toHaveAttribute('data-disks', '2');
});
+ it('colors row metric bars from alert-configured thresholds, not display defaults', () => {
+ render(() => (
+ <DockerHostsTable
+ resources={[makeDockerHost()]}
+ emptyIcon={<span />}
+ emptyTitle="No Docker hosts"
+ emptyDescription="No hosts"
+ showToolbar={false}
+ />
+ ));
+
+ expect(screen.getByTestId('responsive-cpu-metric')).toHaveAttribute(
+ 'data-thresholds',
+ '80/85',
+ );
+ expect(screen.getByTestId('stacked-memory-bar')).toHaveAttribute('data-thresholds', '90/95');
+ expect(screen.getByTestId('stacked-disk-bar')).toHaveAttribute('data-thresholds', '80/85');
+ expect(getMetricThresholdsMock).toHaveBeenCalledWith(
+ 'agent',
+ 'memory',
+ expect.arrayContaining(['agent:docker-01']),
+ );
+ });
+
it('opens host details inline without route navigation or submit-style drawer controls', () => {
window.history.pushState({}, '', '/docker/overview');
diff --git a/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx
index 51feee4e4e..f404fb4626 100644
--- a/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx
+++ b/frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx
@@ -7,6 +7,8 @@ import { ResourceNameWithWebInterfaceLink } from '@/components/shared/WebInterfa
import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
import { getSimpleStatusIndicator } from '@/utils/status';
import { asTrimmedString } from '@/utils/stringUtils';
+import { useAlertsActivation } from '@/stores/alertsActivation';
+import { unifiedPlatformOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';
import {
PLATFORM_HEALTH_FILTER_OPTIONS,
PlatformSortableTableHead,
@@ -72,6 +74,7 @@ export const KubernetesClustersTable: Component<{
title?: string;
showToolbar?: boolean;
}> = (props) => {
+ const alertsActivation = useAlertsActivation();
const tableState = createPlatformTableFilterState({
resources: () => props.clusters,
initialStatus: 'all' as KubernetesResourceStatusFilter,
@@ -246,6 +249,15 @@ export const KubernetesClustersTable: Component<{
const context = () => formatPlatformTableTextValue(cluster.kubernetes?.context);
const version = () => formatPlatformTableTextValue(cluster.kubernetes?.version);
const metricsKey = () => buildMetricKeyForUnifiedResource(cluster);
+ const alertResourceIds = () => unifiedPlatformOverrideIdCandidates(cluster);
+ const cpuThresholds = () =>
+ alertsActivation.getMetricThresholds('kubernetes', 'cpu', alertResourceIds());
+ const memoryThresholds = () =>
+ alertsActivation.getMetricThresholds(
+ 'kubernetes',
+ 'memory',
+ alertResourceIds(),
+ );
const cpuPercent = () => getPlatformTableFiniteMetric(cluster.cpu?.current);
const memoryTotal = () =>
getPlatformTableFiniteMetric(cluster.memory?.total) ?? 0;
@@ -352,6 +364,7 @@ export const KubernetesClustersTable: Component<{
resourceId={metricsKey()}
isRunning={canRenderMetrics() && cpuPercent() !== undefined}
showMobile={false}
+ thresholds={cpuThresholds()}
/>
</TableCell>
<TableCell
@@ -365,6 +378,7 @@ export const KubernetesClustersTable: Component<{
used={memoryUsed()}
total={memoryTotal()}
percentOnly={memoryPercentOnly()}
+ thresholds={memoryThresholds()}
/>
</Show>
</TableCell>
diff --git a/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx
index decf8580b9..04533eec91 100644
--- a/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx
+++ b/frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx
@@ -8,6 +8,7 @@ import { asTrimmedString } from '@/utils/stringUtils';
import { getAlertStyles } from '@/utils/alerts';
import { useWebSocket } from '@/contexts/appRuntime';
import { useAlertsActivation } from '@/stores/alertsActivation';
+import { unifiedPlatformOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';
import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
import {
PLATFORM_HEALTH_FILTER_OPTIONS,
@@ -300,6 +301,15 @@ export const KubernetesNodesTable: Component<{
};
const indicator = () => mapKubernetesNodeStatus(node);
const metricsKey = () => buildMetricKeyForUnifiedResource(node);
+ const alertResourceIds = () => unifiedPlatformOverrideIdCandidates(node);
+ const cpuThresholds = () =>
+ alertsActivation.getMetricThresholds('kubernetes', 'cpu', alertResourceIds());
+ const memoryThresholds = () =>
+ alertsActivation.getMetricThresholds(
+ 'kubernetes',
+ 'memory',
+ alertResourceIds(),
+ );
const cpuPercent = () => getPlatformTableFiniteMetric(node.cpu?.current);
const memoryTotal = () => getPlatformTableFiniteMetric(node.memory?.total) ?? 0;
const memoryUsed = () => getPlatformTableFiniteMetric(node.memory?.used) ?? 0;
@@ -387,6 +397,7 @@ export const KubernetesNodesTable: Component<{
resourceId={metricsKey()}
isRunning={canRenderMetrics() && cpuPercent() !== undefined}
showMobile={false}
+ thresholds={cpuThresholds()}
/>
</TableCell>
<TableCell
@@ -400,6 +411,7 @@ export const KubernetesNodesTable: Component<{
used={memoryUsed()}
total={memoryTotal()}
percentOnly={memoryPercentOnly()}
+ thresholds={memoryThresholds()}
/>
</Show>
</TableCell>
diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesNodesTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesNodesTable.test.tsx
index ad995f0451..e77bb52fbf 100644
--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesNodesTable.test.tsx
+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesNodesTable.test.tsx
@@ -17,7 +17,10 @@ vi.mock('@/contexts/appRuntime', () => ({
}));
vi.mock('@/stores/alertsActivation', () => ({
- useAlertsActivation: () => ({ detectionEnabled: () => true }),
+ useAlertsActivation: () => ({
+ detectionEnabled: () => true,
+ getMetricThresholds: () => ({ warning: 80, critical: 85 }),
+ }),
}));
const makeNodeResource = (overrides: Partial<Resource> = {}): Resource => ({
diff --git a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
index 344690bd2c..68843c7142 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
@@ -303,6 +303,12 @@ export const ProxmoxNodesTable: Component<{
const alertResourceIds = () => hostOverrideIdCandidates(node);
const temperatureThresholds = () =>
alertsActivation.getMetricThresholds('node', 'temperature', alertResourceIds());
+ const cpuThresholds = () =>
+ alertsActivation.getMetricThresholds('node', 'cpu', alertResourceIds());
+ const memoryThresholds = () =>
+ alertsActivation.getMetricThresholds('node', 'memory', alertResourceIds());
+ const diskThresholds = () =>
+ alertsActivation.getMetricThresholds('node', 'disk', alertResourceIds());
const cpuPercent = () => getPlatformTableFiniteMetric(node.cpu?.current) ?? 0;
const memoryUsed = () => getPlatformTableFiniteMetric(node.memory?.used) ?? 0;
const memoryTotal = () => getPlatformTableFiniteMetric(node.memory?.total) ?? 0;
@@ -432,6 +438,7 @@ export const ProxmoxNodesTable: Component<{
resourceId={metricsKey()}
isRunning
showMobile={false}
+ thresholds={cpuThresholds()}
/>
}
>
@@ -466,6 +473,7 @@ export const ProxmoxNodesTable: Component<{
cacheInclusiveLabel="Shown in Proxmox"
swapUsed={drawerNode()?.memory?.swapUsed || 0}
swapTotal={drawerNode()?.memory?.swapTotal || 0}
+ thresholds={memoryThresholds()}
/>
}
>
@@ -501,6 +509,7 @@ export const ProxmoxNodesTable: Component<{
}
disks={normalizeDiskArray(node.agent?.disks)}
aggregateDisk={aggregateDisk()}
+ thresholds={diskThresholds()}
/>
}
>
diff --git a/frontend-modern/src/features/truenas/TrueNASAppsTable.tsx b/frontend-modern/src/features/truenas/TrueNASAppsTable.tsx
index f98e7bf1c9..013b3df4ec 100644
--- a/frontend-modern/src/features/truenas/TrueNASAppsTable.tsx
+++ b/frontend-modern/src/features/truenas/TrueNASAppsTable.tsx
@@ -7,6 +7,8 @@ import { getShortImageName } from '@/utils/format';
import { getSimpleStatusIndicator } from '@/utils/status';
import { asTrimmedString } from '@/utils/stringUtils';
import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
+import { useAlertsActivation } from '@/stores/alertsActivation';
+import { unifiedPlatformOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';
import {
PlatformSortableTableHead,
PlatformTableMetricFallback,
@@ -176,6 +178,7 @@ export const TrueNASAppsTable: Component<{
emptyDescription: string;
showToolbar?: boolean;
}> = (props) => {
+ const alertsActivation = useAlertsActivation();
const tableState = createPlatformTableFilterState({
resources: () => props.apps,
initialStatus: 'all' as TrueNASAppStatusFilter,
@@ -303,6 +306,11 @@ export const TrueNASAppsTable: Component<{
const displayStatus = () => getTrueNASResourceDisplayStatus(resource);
const indicator = () => getSimpleStatusIndicator(displayStatus());
const metricsKey = () => buildMetricKeyForUnifiedResource(resource);
+ const alertResourceIds = () => unifiedPlatformOverrideIdCandidates(resource);
+ const cpuThresholds = () =>
+ alertsActivation.getMetricThresholds('truenas', 'cpu', alertResourceIds());
+ const memoryThresholds = () =>
+ alertsActivation.getMetricThresholds('truenas', 'memory', alertResourceIds());
const cpuPercent = () => getPlatformTableFiniteMetric(resource.cpu?.current);
const memoryTotal = () =>
getPlatformTableFiniteMetric(resource.memory?.total) ?? 0;
@@ -373,6 +381,7 @@ export const TrueNASAppsTable: Component<{
resourceId={metricsKey()}
isRunning={canRenderMetrics()}
fallback={<PlatformTableMetricFallback />}
+ thresholds={cpuThresholds()}
/>
</Show>
</TableCell>
@@ -385,6 +394,7 @@ export const TrueNASAppsTable: Component<{
used={memoryUsed()}
total={memoryTotal()}
percentOnly={memoryPercentOnly()}
+ thresholds={memoryThresholds()}
/>
</Show>
</TableCell>
diff --git a/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx b/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx
index c2c3059678..8c6457ee87 100644
--- a/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx
+++ b/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx
@@ -7,6 +7,7 @@ import { getSimpleStatusIndicator } from '@/utils/status';
import { getAlertStyles } from '@/utils/alerts';
import { useWebSocket } from '@/contexts/appRuntime';
import { useAlertsActivation } from '@/stores/alertsActivation';
+import { unifiedPlatformOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';
import { asTrimmedString } from '@/utils/stringUtils';
import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
import {
@@ -314,6 +315,11 @@ export const TrueNASSystemsTable: Component<{
.filter(Boolean)
.join(' · ');
const metricsKey = () => buildMetricKeyForUnifiedResource(system);
+ const alertResourceIds = () => unifiedPlatformOverrideIdCandidates(system);
+ const cpuThresholds = () =>
+ alertsActivation.getMetricThresholds('truenas', 'cpu', alertResourceIds());
+ const memoryThresholds = () =>
+ alertsActivation.getMetricThresholds('truenas', 'memory', alertResourceIds());
const cpuPercent = () => getPlatformTableFiniteMetric(system.cpu?.current);
const memoryTotal = () =>
getPlatformTableFiniteMetric(system.memory?.total) ?? 0;
@@ -387,6 +393,7 @@ export const TrueNASSystemsTable: Component<{
resourceId={metricsKey()}
isRunning={canRenderMetrics() && cpuPercent() !== undefined}
showMobile={false}
+ thresholds={cpuThresholds()}
/>
</TableCell>
<TableCell
@@ -400,6 +407,7 @@ export const TrueNASSystemsTable: Component<{
used={memoryUsed()}
total={memoryTotal()}
percentOnly={memoryPercentOnly()}
+ thresholds={memoryThresholds()}
/>
</Show>
</TableCell>
diff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx
index 3498c1f76d..820e9ec63e 100644
--- a/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx
+++ b/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx
@@ -13,7 +13,10 @@ vi.mock('@/contexts/appRuntime', () => ({
useWebSocket: () => ({ activeAlerts: {} as Record<string, never> }),
}));
vi.mock('@/stores/alertsActivation', () => ({
- useAlertsActivation: () => ({ detectionEnabled: () => true }),
+ useAlertsActivation: () => ({
+ detectionEnabled: () => true,
+ getMetricThresholds: () => ({ warning: 80, critical: 85 }),
+ }),
}));
import { TrueNASSystemsTable } from '@/features/truenas/TrueNASSystemsTable';
diff --git a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
index f6b13259fe..ee525d2e02 100644
--- a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
@@ -7,6 +7,7 @@ import { getSimpleStatusIndicator } from '@/utils/status';
import { getAlertStyles } from '@/utils/alerts';
import { useWebSocket } from '@/contexts/appRuntime';
import { useAlertsActivation } from '@/stores/alertsActivation';
+import { unifiedPlatformOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';
import { asTrimmedString } from '@/utils/stringUtils';
import { formatVmwareClusterServices } from '@/utils/vmwareDisplay';
import {
@@ -324,6 +325,11 @@ export const VsphereHostsTable: Component<{
const displayStatus = () => getVmwareResourceDisplayStatus(host);
const indicator = () => getSimpleStatusIndicator(displayStatus());
const metricsKey = () => buildMetricKeyForUnifiedResource(host);
+ const alertResourceIds = () => unifiedPlatformOverrideIdCandidates(host);
+ const cpuThresholds = () =>
+ alertsActivation.getMetricThresholds('vmware', 'cpu', alertResourceIds());
+ const memoryThresholds = () =>
+ alertsActivation.getMetricThresholds('vmware', 'memory', alertResourceIds());
const cpuPercent = () => getPlatformTableFiniteMetric(host.cpu?.current);
const memoryTotal = () => getPlatformTableFiniteMetric(host.memory?.total) ?? 0;
const memoryUsed = () => getPlatformTableFiniteMetric(host.memory?.used) ?? 0;
@@ -418,6 +424,7 @@ export const VsphereHostsTable: Component<{
resourceId={metricsKey()}
isRunning={canRenderMetrics() && cpuPercent() !== undefined}
showMobile={false}
+ thresholds={cpuThresholds()}
/>
</TableCell>
<TableCell
@@ -431,6 +438,7 @@ export const VsphereHostsTable: Component<{
used={memoryUsed()}
total={memoryTotal()}
percentOnly={memoryPercentOnly()}
+ thresholds={memoryThresholds()}
/>
</Show>
</TableCell>
diff --git a/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx b/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
index 42a9dab4ae..8cedb2b1b6 100644
--- a/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
+++ b/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
@@ -13,7 +13,10 @@ vi.mock('@/contexts/appRuntime', () => ({
useWebSocket: () => ({ activeAlerts: {} as Record<string, never> }),
}));
vi.mock('@/stores/alertsActivation', () => ({
- useAlertsActivation: () => ({ detectionEnabled: () => true }),
+ useAlertsActivation: () => ({
+ detectionEnabled: () => true,
+ getMetricThresholds: () => ({ warning: 80, critical: 85 }),
+ }),
}));
import { VsphereHostsTable } from '@/features/vmware/VsphereHostsTable';
diff --git a/frontend-modern/src/utils/__tests__/metricThresholds.test.ts b/frontend-modern/src/utils/__tests__/metricThresholds.test.ts
index 72d0a07929..6fd2221972 100644
--- a/frontend-modern/src/utils/__tests__/metricThresholds.test.ts
+++ b/frontend-modern/src/utils/__tests__/metricThresholds.test.ts
@@ -224,6 +224,44 @@ describe('metricThresholds', () => {
});
});
+ it('resolves kubernetes, truenas, and vmware scope defaults with factory fallbacks', () => {
+ const config = {
+ enabled: true,
+ guestDefaults: {},
+ nodeDefaults: {},
+ storageDefault: { trigger: 85, clear: 80 },
+ kubernetesDefaults: {
+ memory: { trigger: 92, clear: 87 },
+ },
+ overrides: {
+ 'k8s:prod:node:worker-01': {
+ cpu: { trigger: 97, clear: 94 },
+ },
+ },
+ } as AlertConfig;
+
+ expect(resolveMetricDisplayThresholds(config, 'kubernetes', 'memory')).toEqual({
+ warning: 87,
+ critical: 92,
+ });
+ expect(
+ resolveMetricDisplayThresholds(config, 'kubernetes', 'cpu', ['k8s:prod:node:worker-01']),
+ ).toEqual({
+ warning: 94,
+ critical: 97,
+ });
+ // No configured defaults: factory platform defaults apply, not the
+ // hardcoded METRIC_THRESHOLDS display constants.
+ expect(resolveMetricDisplayThresholds(config, 'truenas', 'disk')).toEqual({
+ warning: 80,
+ critical: 85,
+ });
+ expect(resolveMetricDisplayThresholds(config, 'vmware', 'memory')).toEqual({
+ warning: 80,
+ critical: 85,
+ });
+ });
+
it('does not treat external notification activation as detector state', () => {
const config = {
enabled: true,
diff --git a/frontend-modern/src/utils/metricThresholds.ts b/frontend-modern/src/utils/metricThresholds.ts
index 87d1664a16..d227176fa6 100644
--- a/frontend-modern/src/utils/metricThresholds.ts
+++ b/frontend-modern/src/utils/metricThresholds.ts
@@ -18,15 +18,27 @@ import {
FACTORY_DISK_TEMP_BY_TYPE,
FACTORY_DOCKER_DEFAULTS,
FACTORY_GUEST_DEFAULTS,
+ FACTORY_KUBERNETES_DEFAULTS,
FACTORY_NODE_DEFAULTS,
FACTORY_PBS_DEFAULTS,
FACTORY_STORAGE_DEFAULT,
+ FACTORY_TRUENAS_DEFAULTS,
+ FACTORY_VMWARE_DEFAULTS,
} from '@/utils/alertThresholdDefaults';
export type MetricType = 'cpu' | 'memory' | 'disk';
export type DisplayMetricType = MetricType | 'temperature' | 'diskTemperature' | 'usage';
export type DisplayMetricBarType = MetricType | 'generic';
-export type AlertThresholdScope = 'guest' | 'node' | 'pbs' | 'agent' | 'docker' | 'storage';
+export type AlertThresholdScope =
+ | 'guest'
+ | 'node'
+ | 'pbs'
+ | 'agent'
+ | 'docker'
+ | 'storage'
+ | 'kubernetes'
+ | 'truenas'
+ | 'vmware';
export interface MetricDisplayThresholds {
warning: number;
@@ -66,6 +78,9 @@ const SCOPE_DEFAULTS: Record<
pbs: FACTORY_PBS_DEFAULTS,
agent: FACTORY_AGENT_DEFAULTS,
docker: FACTORY_DOCKER_DEFAULTS,
+ kubernetes: FACTORY_KUBERNETES_DEFAULTS,
+ truenas: FACTORY_TRUENAS_DEFAULTS,
+ vmware: FACTORY_VMWARE_DEFAULTS,
};
const toFiniteNumber = (value: unknown): number | null => {
@@ -104,6 +119,12 @@ const getScopeThresholds = (
return config?.dockerDefaults;
case 'storage':
return config?.storageDefault;
+ case 'kubernetes':
+ return config?.kubernetesDefaults;
+ case 'truenas':
+ return config?.truenasDefaults;
+ case 'vmware':
+ return config?.vmwareDefaults;
}
};