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.

fix(alerts): correlate linked outage signals

Pulse Test6db3cc861672
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 7668741350..040f6287b9 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -6812,3 +6812,19 @@ authority; it only prevents the first accepted agent observation from losing
its alert consequence. `TestNewMonitorRoutesStartupCustomSensorWarningBeforeStart`
in `internal/monitoring/monitor_host_agents_test.go` pins the pre-`Start`
warning path.
+
+### Alert correlation consumes links without gaining lifecycle authority
+
+Monitoring may read the canonical reciprocal `Host.LinkedNodeID` and
+`Node.LinkedAgentID` relationship to attach alerts-owned shared-system context
+to a host connectivity signal. Both sides must match exactly and the node must
+identify one non-empty PVE instance; incomplete or conflicting evidence yields
+no correlation. This adapter cannot create, heal, persist, remove, or otherwise
+reinterpret an agent link, and it cannot merge the host detector lifecycle
+with the PVE connection or node lifecycle.
+
+The correlation contains no credential, enrollment, command, token, or
+authority state. Agent lifecycle remains the sole owner of the relationship;
+alerts receives only a bounded presentation identity after that relationship
+has already been established. The reciprocal and fail-open cases are pinned in
+`internal/monitoring/monitor_host_agents_test.go`.
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 33643aa428..64eeda8862 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -2415,3 +2415,30 @@ usable filesystem evidence exists. OS-managed transient mounts, including
macOS Gatekeeper App Translocation volumes, are removed at the shared
filesystem collection boundary before they can enter capacity inventory or
alert evaluation.
+
+### Shared-system correlation never merges detector lifecycles
+
+An active alert may carry the optional typed `correlation` object with a
+`shared-system` kind, stable key, `primary` or `supporting` role, and an
+auditable reason. This is presentation-only incident context. Every correlated
+signal retains its own canonical spec, confirmation state, acknowledgement,
+recovery evidence, history, and notification decision; recovery of one signal
+must never clear another.
+
+Proxmox connection availability is the primary signal for its `pve:<instance>`
+system. PVE node connectivity is a supporting signal through provider-owned
+instance membership. A linked host-agent connectivity alert is supporting only
+when monitoring proves the reciprocal node ID and agent ID relationship and
+the node supplies the same non-empty instance. Missing, one-sided, duplicate,
+or conflicting identity fails open and leaves alerts separate. Resource-path
+truncation, hostname similarity, and timing coincidence are forbidden as
+correlation evidence.
+
+The overview groups exact-resource detector signals and explicit shared-system
+signals. It selects a declared primary when one is present, describes the rest
+as linked signals, and acknowledges each underlying alert individually. Older
+alerts and clients remain compatible because the field is additive and
+optional. `internal/alerts/correlation_test.go`,
+`internal/monitoring/alert_correlation_test.go`, and
+`frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx`
+pin lifecycle independence, fail-open identity, and client grouping.
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index e229fa0ce0..0334403d9e 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -10136,3 +10136,21 @@ inside schema-aware version cohorts. New schema v15 classifications enter
pre-upgrade rows can preserve the schema v5-v14 4xx-or-5xx meaning for up to
seven days, so the first rolling snapshot is a baseline rather than attributed
same-version activity.
+
+### Alert correlation is additive presentation context
+
+Canonical active and resolved alert payloads may add an optional `correlation`
+object. Its closed current shape is `{key, kind: "shared-system", role,
+reason}`, where `role` is `primary` or `supporting`. Absence means the client
+must keep the alert independent except for exact-resource grouping. Clients
+must not reconstruct cross-resource correlation from resource path segments,
+hostnames, message text, or timestamps.
+
+The object does not replace alert ID, canonical spec ID, resource ID,
+acknowledgement, transitions, or evidence. Bulk and group acknowledgement
+still submit every underlying alert identifier, and older clients may ignore
+the additive object. Go cloning and persistence preserve the object without
+sharing mutable pointers; the frontend API type mirrors the optional wire
+shape exactly. `internal/alerts/correlation_test.go` and
+`frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx`
+are the focused transport-consumer proofs.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 72ae89c1f9..5f7699224f 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -6804,3 +6804,18 @@ and states every lifecycle condition that stops paging. Desktop and mobile
layouts must retain associated labels and avoid horizontal overflow. Escalation
level delays and repeat intervals share the rendered 5–180 minute bounds; the
feature state clamps typed values before they can leave the control surface.
+
+### Alert groups use the shared localization boundary
+
+Alert group disclosure and group acknowledgement copy routes through
+`alertOverviewPresentation` and the shared English, German, and Spanish
+catalogs. The presentation distinguishes a backend-declared shared-system
+relationship (`linked signal(s)`) from multiple detectors on the exact same
+resource (`related`) while keeping expansion and acknowledgement controls in
+the existing alert surface. Components must not hardcode this vocabulary or
+render the backend correlation reason or key as operator copy.
+
+The labels retain singular/plural behavior, use the existing responsive button
+primitives, and introduce no parallel group component. Localization and
+presentation proofs live in `frontend-modern/src/i18n/__tests__/i18n.test.ts`
+and `frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts`.
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 0b354fc814..154a782f24 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -3460,3 +3460,19 @@ emitting the repeated authentication warning used for cluster-scoped 595,
401, and 403 responses. Returned errors retain their compatibility shape;
`pkg/proxmox/client_request_test.go` pins both sides of the log classification
(#1794).
+
+### Monitoring supplies fail-open shared-system alert identity
+
+Host-agent availability evaluation may attach alerts-owned shared-system
+context only from monitoring's canonical reciprocal PVE node-agent link. The
+host `linkedNodeId` and node `linkedAgentId` must name each other exactly, and
+the matched node must supply one unambiguous non-empty PVE instance. Missing,
+one-sided, or conflicting evidence returns no correlation. Monitoring does not
+use hostnames, resource-path prefixes, or observation timing to manufacture a
+relationship, and it does not merge alert lifecycle state.
+
+This adapter is read-only and bounded to the host evaluation snapshot. Alerts
+owns the correlation wire type and presentation semantics; monitoring owns the
+identity evidence that permits the host signal to join that system.
+`internal/monitoring/alert_correlation_test.go` pins reciprocal-link admission
+and every fail-open case.
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 8fb4290954..b4873478aa 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -2495,3 +2495,21 @@ floor but never the Relay private key, and omitted or invalid floors fail open
to `all` rather than silently suppressing warnings. Payload-shape and config
normalization proofs live in `internal/relay/push_test.go` and
`internal/api/relay_hosted_runtime_test.go`.
+
+### Alert correlation stays inside authenticated incident context
+
+The optional alert `correlation` object carries only a bounded shared-system
+key, kind, presentation role, and auditable reason. It is available through the
+same authenticated alert read surfaces as the resource and instance identity
+already present on the alert; it must not be copied into public telemetry,
+lock-screen push copy, notification destination configuration, or
+unauthenticated status output. The overview uses only the typed role and group
+membership and does not render the raw key or reason.
+
+Malformed, unsupported, or incomplete persisted correlation fails open during
+alert cloning and is omitted from client payloads. Clients likewise require
+the closed `shared-system` kind and a non-empty key before cross-resource
+grouping, and they never infer identity from hostnames, message text,
+timestamps, or resource-path truncation. `internal/alerts/correlation_test.go`
+and the alerts overview state tests pin these disclosure and fail-open
+boundaries.
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 894e2cc1fa..024af55138 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,19 +1,31 @@
{
"version": 1,
- "base_sha": "974f102333d5e394ce6ddf966ad2759d1888386f",
- "verified_at": "2026-08-29T15:34:14Z",
+ "base_sha": "d671f05408c909dc1e418ac149192c5db01d3d84",
+ "verified_at": "2026-08-29T17:05:39Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/components/shared/DetailSectionTable.tsx"
+ "frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx",
+ "frontend-modern/src/features/alerts/useAlertOverviewState.ts",
+ "frontend-modern/src/i18n/messages.de.ts",
+ "frontend-modern/src/i18n/messages.es.ts",
+ "frontend-modern/src/i18n/messages.ts",
+ "frontend-modern/src/types/api.ts",
+ "frontend-modern/src/utils/alertOverviewPresentation.ts"
],
"content_sha256": {
- "frontend-modern/src/components/shared/DetailSectionTable.tsx": "9164c52fe67c6e6504a961a48e562479613d498d8d12ae10411d5b193dba36b5"
+ "frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx": "396b3b8eb61f094bf2c57a46d45751fd349469c0d153074f1af9b01742dfab78",
+ "frontend-modern/src/features/alerts/useAlertOverviewState.ts": "1eea31a6a8c4a6e181fa478c7b578590d26e1c9219b8ed9c3cfc8b76ae9bb370",
+ "frontend-modern/src/i18n/messages.de.ts": "c5e5f16d3e7c6d7a741e84fc2217e08aa6b257c4a6a7fa0e9009c993534eb8e7",
+ "frontend-modern/src/i18n/messages.es.ts": "048749c66b51d3c063e94b4742dfb21b20de70d13ad09216ef7d73b4fd98c13a",
+ "frontend-modern/src/i18n/messages.ts": "b1af1ee4f56039e6263685df8d776f7e14e32fe8fb7d84cd2f03992c01d09c18",
+ "frontend-modern/src/types/api.ts": "6f118c6c43b4ccc5cb11c440267797bee0c36a8e5ffa95aa94112419d28d56fa",
+ "frontend-modern/src/utils/alertOverviewPresentation.ts": "00aab1c0a3f2bdb78c4efb6effdb5fa4a95560f0f73f9e5e7f084e4db98e2057"
},
- "routes": ["/proxmox/overview"],
+ "routes": ["/alerts/overview"],
"viewports": [
{
- "width": 1920,
- "height": 900
+ "width": 1440,
+ "height": 1000
},
{
"width": 390,
@@ -21,13 +33,14 @@
}
],
"states": [
- "mock-backed Proxmox Overview with a seven-section node drawer expanded",
- "desktop node details aligned to four shared column tracks across both rows",
- "compact mobile node details retained as one full-width bordered table"
+ "mock-backed Alerts Overview with forty or more active detector signals",
+ "same-resource alert group collapsed with the localized related-signal disclosure",
+ "same-resource alert group expanded with its underlying alert card and group acknowledgement action",
+ "desktop and narrow layouts with unacknowledged critical and warning cards"
],
"interactions": [
- "opened Proxmox Overview at 1920x900, expanded Analytics A, and confirmed the four first-row cards share equal quarter-width tracks",
- "confirmed Network spans two desktop tracks while Storage and Telemetry each span one, filling the final row with aligned card edges",
- "repeated the expanded drawer at 390x844 and confirmed every section remains a full-width table row group with adjacent labels and values"
+ "opened Alerts Overview at 1440x1000 and confirmed active cards, group disclosure, and acknowledgement controls are aligned and unclipped",
+ "expanded and collapsed a two-signal alert group and confirmed the nested alert remains visually subordinate while retaining its own controls",
+ "repeated the expanded and collapsed group at 390x844 and confirmed the document and body remain exactly 390 pixels wide with no horizontal overflow"
]
}
diff --git a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
index f3e62f18cb..9adaefa300 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
@@ -8,6 +8,8 @@ import {
getAlertOverviewActiveSectionTitle,
getAlertOverviewBulkAcknowledgeLabel,
getAlertOverviewEmptyState,
+ getAlertOverviewGroupAcknowledgeLabel,
+ getAlertOverviewGroupDisclosureLabel,
getAlertOverviewPausedState,
getAlertListEmptyState,
} from '@/utils/alertOverviewPresentation';
@@ -140,7 +142,11 @@ export function AlertOverviewActiveAlertsSection(props: AlertOverviewActiveAlert
class="text-xs text-muted hover:text-base-content transition-colors"
onClick={() => toggleGroup(group.key)}
>
- {isGroupExpanded(group.key) ? 'Hide' : `+${group.related.length} related`}
+ {getAlertOverviewGroupDisclosureLabel({
+ count: group.related.length,
+ correlated: group.correlated,
+ expanded: isGroupExpanded(group.key),
+ })}
</button>
<Show when={[group.primary, ...group.related].some((a) => !a.acknowledged)}>
<button
@@ -153,7 +159,7 @@ export function AlertOverviewActiveAlertsSection(props: AlertOverviewActiveAlert
]);
}}
>
- Ack all ({group.related.length + 1})
+ {getAlertOverviewGroupAcknowledgeLabel(group.related.length + 1)}
</button>
</Show>
</div>
diff --git a/frontend-modern/src/features/alerts/__tests__/alertsLocalization.guardrails.test.ts b/frontend-modern/src/features/alerts/__tests__/alertsLocalization.guardrails.test.ts
index 96dd0c9553..f29d24c043 100644
--- a/frontend-modern/src/features/alerts/__tests__/alertsLocalization.guardrails.test.ts
+++ b/frontend-modern/src/features/alerts/__tests__/alertsLocalization.guardrails.test.ts
@@ -73,6 +73,7 @@ describe('alerts overview localization guardrails', () => {
expect(alertsPageSource).toContain('alerts.nav.toggleAlerts');
expect(activeAlertsSectionSource).toContain('getAlertOverviewActiveSectionTitle');
+ expect(activeAlertsSectionSource).toContain('getAlertOverviewGroupDisclosureLabel');
expect(alertCardSource).toContain('getAlertOverviewPrimaryActionLabel');
expect(statsCardsSource).toContain('getAlertOverviewStatsLabels');
expect(acknowledgementStateSource).toContain('getAlertOverviewAcknowledgedNotification');
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx
index ca17c24b5c..3107a06b81 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx
@@ -160,4 +160,91 @@ describe('useAlertOverviewState', () => {
expect(stats.total24h).toBe(3);
expect(stats.acknowledged).toBe(0);
});
+
+ it('groups only explicit shared-system correlations across resources', () => {
+ const startTime = new Date(Date.now() - 60_000).toISOString();
+ const connection = {
+ ...makeAlert('connection', startTime),
+ resourceId: 'pve:delly',
+ correlation: {
+ key: 'pve:delly',
+ kind: 'shared-system' as const,
+ role: 'primary' as const,
+ reason: 'proxmox-connection-ownership',
+ },
+ };
+ const node = {
+ ...makeAlert('node', startTime),
+ resourceId: 'node/delly/pve-1',
+ level: 'critical' as const,
+ correlation: {
+ key: 'pve:delly',
+ kind: 'shared-system' as const,
+ role: 'supporting' as const,
+ reason: 'proxmox-node-membership',
+ },
+ };
+ const [activeAlerts] = createSignal<Record<string, Alert>>({ connection, node });
+
+ const { result } = renderHook(() =>
+ useAlertOverviewState({
+ activeAlerts,
+ overrides: () => [],
+ showAcknowledged: () => true,
+ updateAlert: vi.fn(),
+ }),
+ );
+
+ expect(result.groupedAlerts()).toEqual([
+ expect.objectContaining({
+ key: 'correlation:shared-system:pve:delly',
+ primary: connection,
+ related: [node],
+ correlated: true,
+ }),
+ ]);
+ });
+
+ it('does not infer correlation by truncating resource paths', () => {
+ const startTime = new Date(Date.now() - 60_000).toISOString();
+ const first = { ...makeAlert('first', startTime), resourceId: 'host/one/disk:sda' };
+ const second = { ...makeAlert('second', startTime), resourceId: 'host/one/disk:sdb' };
+ const [activeAlerts] = createSignal<Record<string, Alert>>({ first, second });
+
+ const { result } = renderHook(() =>
+ useAlertOverviewState({
+ activeAlerts,
+ overrides: () => [],
+ showAcknowledged: () => true,
+ updateAlert: vi.fn(),
+ }),
+ );
+
+ expect(result.groupedAlerts()).toHaveLength(2);
+ expect(result.groupedAlerts().every((group) => !group.correlated)).toBe(true);
+ });
+
+ it('still groups multiple detector signals for the exact same resource', () => {
+ const startTime = new Date(Date.now() - 60_000).toISOString();
+ const first = { ...makeAlert('first', startTime), resourceId: 'vm/delly/100' };
+ const second = { ...makeAlert('second', startTime), resourceId: 'vm/delly/100' };
+ const [activeAlerts] = createSignal<Record<string, Alert>>({ first, second });
+
+ const { result } = renderHook(() =>
+ useAlertOverviewState({
+ activeAlerts,
+ overrides: () => [],
+ showAcknowledged: () => true,
+ updateAlert: vi.fn(),
+ }),
+ );
+
+ expect(result.groupedAlerts()).toEqual([
+ expect.objectContaining({
+ key: 'resource:vm/delly/100',
+ related: [second],
+ correlated: false,
+ }),
+ ]);
+ });
});
diff --git a/frontend-modern/src/features/alerts/useAlertOverviewState.ts b/frontend-modern/src/features/alerts/useAlertOverviewState.ts
index 9dcfe453ec..13499fa00d 100644
--- a/frontend-modern/src/features/alerts/useAlertOverviewState.ts
+++ b/frontend-modern/src/features/alerts/useAlertOverviewState.ts
@@ -11,15 +11,16 @@ export interface AlertGroup {
key: string;
primary: Alert;
related: Alert[];
+ correlated: boolean;
}
export function computeAlertGroupKey(alert: Alert): string {
- const rid = alert.resourceId ?? '';
- const segments = rid.split('/');
- if (segments.length > 2) {
- return segments.slice(0, -1).join('/');
+ const correlation = alert.correlation;
+ if (correlation?.kind === 'shared-system' && correlation.key.trim() !== '') {
+ return `correlation:${correlation.kind}:${correlation.key.trim()}`;
}
- return rid;
+ const resourceId = alert.resourceId?.trim();
+ return resourceId ? `resource:${resourceId}` : `alert:${alert.id}`;
}
export interface UseAlertOverviewStateProps {
@@ -146,7 +147,14 @@ export function useAlertOverviewState(props: UseAlertOverviewStateProps) {
}
const result: AlertGroup[] = [];
for (const [key, alerts] of groups) {
- result.push({ key, primary: alerts[0], related: alerts.slice(1) });
+ const primaryIndex = alerts.findIndex((alert) => alert.correlation?.role === 'primary');
+ const primary = primaryIndex >= 0 ? alerts[primaryIndex] : alerts[0];
+ result.push({
+ key,
+ primary,
+ related: alerts.filter((_, index) => index !== (primaryIndex >= 0 ? primaryIndex : 0)),
+ correlated: key.startsWith('correlation:'),
+ });
}
return result;
});
diff --git a/frontend-modern/src/i18n/__tests__/i18n.test.ts b/frontend-modern/src/i18n/__tests__/i18n.test.ts
index 50339c190e..5e110813e3 100644
--- a/frontend-modern/src/i18n/__tests__/i18n.test.ts
+++ b/frontend-modern/src/i18n/__tests__/i18n.test.ts
@@ -115,6 +115,18 @@ describe('i18n foundation', () => {
}
});
+ it('localizes alert group correlation labels across every supported locale', () => {
+ expect(t('alerts.overview.group.linkedSignal', { count: 1 }, 'en')).toBe('+1 linked signal');
+ expect(t('alerts.overview.group.linkedSignal', { count: 1 }, 'de')).toBe(
+ '+1 verknuepftes Signal',
+ );
+ expect(t('alerts.overview.group.linkedSignal', { count: 1 }, 'es')).toBe('+1 senal vinculada');
+ for (const locale of SUPPORTED_LOCALES) {
+ expect(t('alerts.overview.group.linkedSignals', { count: 2 }, locale)).toBeTruthy();
+ expect(t('alerts.overview.group.acknowledge', { count: 3 }, locale)).toBeTruthy();
+ }
+ });
+
it('captures the first and next localization waves without enabling unsupported locales', () => {
expect(FIRST_LOCALIZATION_LOCALES).toEqual(['de', 'es']);
expect(NEXT_LOCALIZATION_LOCALES).toEqual(['fr', 'pt-BR', 'ja', 'zh-Hans', 'ko']);
diff --git a/frontend-modern/src/i18n/messages.de.ts b/frontend-modern/src/i18n/messages.de.ts
index 81e58871dc..0193b0ed14 100644
--- a/frontend-modern/src/i18n/messages.de.ts
+++ b/frontend-modern/src/i18n/messages.de.ts
@@ -69,6 +69,11 @@ export const DE_MESSAGE_OVERRIDES = {
'alerts.overview.action.timeline': 'Zeitleiste',
'alerts.overview.action.snooze': 'Zurueckstellen',
'alerts.overview.action.unacknowledge': 'Bestaetigung aufheben',
+ 'alerts.overview.group.acknowledge': 'Alle bestaetigen ({count})',
+ 'alerts.overview.group.hide': 'Ausblenden',
+ 'alerts.overview.group.linkedSignal': '+{count} verknuepftes Signal',
+ 'alerts.overview.group.linkedSignals': '+{count} verknuepfte Signale',
+ 'alerts.overview.group.related': '+{count} zugehoerig',
'alerts.overview.acknowledgedBadge': 'Bestaetigt',
'alerts.overview.empty.description':
'Warnmeldungen erscheinen hier, wenn Schwellwerte ueberschritten werden',
diff --git a/frontend-modern/src/i18n/messages.es.ts b/frontend-modern/src/i18n/messages.es.ts
index c3860256f7..e2fa409a7f 100644
--- a/frontend-modern/src/i18n/messages.es.ts
+++ b/frontend-modern/src/i18n/messages.es.ts
@@ -68,6 +68,11 @@ export const ES_MESSAGE_OVERRIDES = {
'alerts.overview.action.timeline': 'Linea de tiempo',
'alerts.overview.action.snooze': 'Posponer',
'alerts.overview.action.unacknowledge': 'Quitar reconocimiento',
+ 'alerts.overview.group.acknowledge': 'Reconocer todas ({count})',
+ 'alerts.overview.group.hide': 'Ocultar',
+ 'alerts.overview.group.linkedSignal': '+{count} senal vinculada',
+ 'alerts.overview.group.linkedSignals': '+{count} senales vinculadas',
+ 'alerts.overview.group.related': '+{count} relacionadas',
'alerts.overview.acknowledgedBadge': 'Reconocida',
'alerts.overview.empty.description': 'Las alertas apareceran aqui cuando se superen los umbrales',
'alerts.overview.empty.title': 'No hay alertas activas',
diff --git a/frontend-modern/src/i18n/messages.ts b/frontend-modern/src/i18n/messages.ts
index 6905fa2270..3ccd603fcf 100644
--- a/frontend-modern/src/i18n/messages.ts
+++ b/frontend-modern/src/i18n/messages.ts
@@ -161,6 +161,11 @@ export const EN_MESSAGES = {
'alerts.overview.action.timeline': 'Timeline',
'alerts.overview.action.snooze': 'Snooze',
'alerts.overview.action.unacknowledge': 'Unacknowledge',
+ 'alerts.overview.group.acknowledge': 'Acknowledge all ({count})',
+ 'alerts.overview.group.hide': 'Hide',
+ 'alerts.overview.group.linkedSignal': '+{count} linked signal',
+ 'alerts.overview.group.linkedSignals': '+{count} linked signals',
+ 'alerts.overview.group.related': '+{count} related',
'alerts.overview.acknowledgedBadge': 'Acknowledged',
'alerts.overview.empty.description': 'Alerts will appear here when thresholds are exceeded',
'alerts.overview.empty.title': 'No active alerts',
@@ -764,6 +769,11 @@ export const ALERTS_OVERVIEW_MIGRATED_MESSAGE_KEYS = [
'alerts.overview.action.timeline',
'alerts.overview.action.snooze',
'alerts.overview.action.unacknowledge',
+ 'alerts.overview.group.acknowledge',
+ 'alerts.overview.group.hide',
+ 'alerts.overview.group.linkedSignal',
+ 'alerts.overview.group.linkedSignals',
+ 'alerts.overview.group.related',
'alerts.overview.acknowledgedBadge',
'alerts.overview.empty.description',
'alerts.overview.empty.title',
diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.ts
index b1114daa98..d300184b0e 100644
--- a/frontend-modern/src/types/api.ts
+++ b/frontend-modern/src/types/api.ts
@@ -1297,6 +1297,13 @@ export interface Stats {
}
// Alert types
+export interface AlertCorrelation {
+ key: string;
+ kind: 'shared-system';
+ role: 'primary' | 'supporting';
+ reason: string;
+}
+
export interface Alert {
id: string;
type: string;
@@ -1317,6 +1324,7 @@ export interface Alert {
acknowledged: boolean;
ackTime?: string;
ackUser?: string;
+ correlation?: AlertCorrelation;
metadata?: Record<string, unknown>;
operationalRecord?: OperationalRecord;
latestTransition?: LifecycleTransition;
diff --git a/frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts b/frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts
index 967fde1c65..df01b043df 100644
--- a/frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts
@@ -41,6 +41,8 @@ import {
getAlertOverviewBulkAcknowledgedNotification,
getAlertOverviewCardPresentation,
getAlertOverviewEmptyState,
+ getAlertOverviewGroupAcknowledgeLabel,
+ getAlertOverviewGroupDisclosureLabel,
getAlertOverviewHydrationState,
getAlertOverviewNodeLabel,
getAlertOverviewPausedState,
@@ -84,6 +86,26 @@ import {
getAlertsPageHeaderMeta,
} from '@/utils/alertOverviewPresentation';
+describe('alert overview grouping presentation', () => {
+ afterEach(() => setActiveLocale(DEFAULT_LOCALE));
+
+ it('distinguishes explicit linked signals from same-resource related alerts', () => {
+ expect(
+ getAlertOverviewGroupDisclosureLabel({ count: 1, correlated: true, expanded: false }),
+ ).toBe('+1 linked signal');
+ expect(
+ getAlertOverviewGroupDisclosureLabel({ count: 2, correlated: true, expanded: false }),
+ ).toBe('+2 linked signals');
+ expect(
+ getAlertOverviewGroupDisclosureLabel({ count: 1, correlated: false, expanded: false }),
+ ).toBe('+1 related');
+ expect(
+ getAlertOverviewGroupDisclosureLabel({ count: 1, correlated: true, expanded: true }),
+ ).toBe('Hide');
+ expect(getAlertOverviewGroupAcknowledgeLabel(3)).toBe('Acknowledge all (3)');
+ });
+});
+
describe('alertOverviewPresentation', () => {
beforeEach(() => {
setActiveLocale(DEFAULT_LOCALE);
diff --git a/frontend-modern/src/utils/alertOverviewPresentation.ts b/frontend-modern/src/utils/alertOverviewPresentation.ts
index 84a95871e6..5825a629c3 100644
--- a/frontend-modern/src/utils/alertOverviewPresentation.ts
+++ b/frontend-modern/src/utils/alertOverviewPresentation.ts
@@ -132,6 +132,27 @@ export function getAlertOverviewBulkAcknowledgeLabel(count: number, processing:
: t('alerts.overview.action.acknowledgeAll', { count });
}
+export function getAlertOverviewGroupDisclosureLabel({
+ count,
+ correlated,
+ expanded,
+}: {
+ count: number;
+ correlated: boolean;
+ expanded: boolean;
+}): string {
+ if (expanded) return t('alerts.overview.group.hide');
+ if (!correlated) return t('alerts.overview.group.related', { count });
+ return t(
+ count === 1 ? 'alerts.overview.group.linkedSignal' : 'alerts.overview.group.linkedSignals',
+ { count },
+ );
+}
+
+export function getAlertOverviewGroupAcknowledgeLabel(count: number): string {
+ return t('alerts.overview.group.acknowledge', { count });
+}
+
export function getAlertOverviewAcknowledgedBadgeLabel(): string {
return t('alerts.overview.acknowledgedBadge');
}
diff --git a/internal/alerts/alerts_test.go b/internal/alerts/alerts_test.go
index a7167f81bf..780a68c3d8 100644
--- a/internal/alerts/alerts_test.go
+++ b/internal/alerts/alerts_test.go
@@ -1049,6 +1049,28 @@ func TestHandleHostOfflineRequiresConfirmations(t *testing.T) {
m.mu.RUnlock()
}
+func TestHandleHostOfflineWithCorrelationPreservesHostLifecycleIdentity(t *testing.T) {
+ m := newTestManager(t)
+ host := models.Host{ID: "host-correlated", Hostname: "pve-1"}
+ correlation := NewSharedSystemAlertCorrelation(
+ "pve:delly",
+ AlertCorrelationRoleSupporting,
+ "verified-proxmox-node-agent-link",
+ )
+
+ for range 3 {
+ m.HandleHostOfflineWithCorrelation(host, correlation)
+ }
+
+ alert := testRequireActiveAlert(t, m, canonicalConnectivityStateID(hostResourceID(host.ID)))
+ if alert.ResourceID != hostResourceID(host.ID) {
+ t.Fatalf("host lifecycle resource = %q, want %q", alert.ResourceID, hostResourceID(host.ID))
+ }
+ if alert.Correlation == nil || alert.Correlation.Key != "pve:delly" {
+ t.Fatalf("host alert missing correlation: %+v", alert.Correlation)
+ }
+}
+
func TestCheckHostDisabledOverrideClearsAlerts(t *testing.T) {
m := newTestManager(t)
m.ClearActiveAlerts()
diff --git a/internal/alerts/canonical_lifecycle.go b/internal/alerts/canonical_lifecycle.go
index c50c993652..29c36027a4 100644
--- a/internal/alerts/canonical_lifecycle.go
+++ b/internal/alerts/canonical_lifecycle.go
@@ -26,6 +26,7 @@ type canonicalLifecycleAlertParams struct {
Message string
Value float64
Threshold float64
+ Correlation *AlertCorrelation
Metadata map[string]interface{}
AddToRecent bool
AddToHistory bool
@@ -470,6 +471,7 @@ func (m *Manager) evaluateCanonicalLifecycleAlert(params canonicalLifecycleAlert
Threshold: params.Threshold,
StartTime: incident.StartedAt,
LastSeen: params.Evidence.ObservedAt,
+ Correlation: cloneAlertCorrelation(params.Correlation),
Metadata: cloneMetadata(params.Metadata),
}
if alert.Metadata == nil {
diff --git a/internal/alerts/canonical_stateful_test.go b/internal/alerts/canonical_stateful_test.go
index 798615eae0..5587e38c00 100644
--- a/internal/alerts/canonical_stateful_test.go
+++ b/internal/alerts/canonical_stateful_test.go
@@ -4,10 +4,53 @@ import (
"testing"
"time"
+ alertspecs "github.com/rcourtman/pulse-go-rewrite/internal/alerts/specs"
"github.com/rcourtman/pulse-go-rewrite/internal/storagehealth"
"github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"
)
+func TestCanonicalLifecycleCopiesValidatedAlertCorrelation(t *testing.T) {
+ m := newTestManager(t)
+ spec, err := buildCanonicalConnectivitySpec(
+ "node-1",
+ "Node 1",
+ unifiedresources.ResourceType("node"),
+ AlertLevelCritical,
+ 1,
+ false,
+ )
+ if err != nil {
+ t.Fatalf("build connectivity spec: %v", err)
+ }
+ correlation := NewSharedSystemAlertCorrelation(
+ "pve:delly",
+ AlertCorrelationRoleSupporting,
+ "proxmox-node-membership",
+ )
+
+ _, ok := m.evaluateCanonicalLifecycleAlert(canonicalLifecycleAlertParams{
+ Spec: spec,
+ Evidence: alertspecs.AlertEvidence{ObservedAt: time.Now(), Connectivity: &alertspecs.ConnectivityEvidence{Signal: "status", Connected: false}},
+ AlertID: canonicalConnectivityStateID("node-1"),
+ AlertType: "connectivity",
+ ResourceID: "node-1",
+ ResourceName: "Node 1",
+ Correlation: correlation,
+ })
+ if !ok {
+ t.Fatal("expected canonical lifecycle evaluation")
+ }
+
+ alert := testRequireActiveAlert(t, m, canonicalConnectivityStateID("node-1"))
+ if alert.Correlation == nil || alert.Correlation.Key != "pve:delly" {
+ t.Fatalf("canonical alert missing correlation: %+v", alert.Correlation)
+ }
+ correlation.Key = "pve:changed"
+ if alert.Correlation.Key != "pve:delly" {
+ t.Fatal("canonical alert retained the caller's mutable correlation pointer")
+ }
+}
+
func TestStatefulAlertReFireCooldown(t *testing.T) {
t.Run("re-fire within cooldown does not create duplicate history entry", func(t *testing.T) {
m := newTestManager(t)
diff --git a/internal/alerts/connection.go b/internal/alerts/connection.go
index 372e0afaa0..0876921825 100644
--- a/internal/alerts/connection.go
+++ b/internal/alerts/connection.go
@@ -221,6 +221,14 @@ func (m *Manager) CheckConnection(snap ConnectionSnapshot) {
"connectionType": string(snap.Type),
"state": string(snap.State),
}
+ var correlation *AlertCorrelation
+ if snap.Type == ConnectionTypePVE {
+ correlation = NewSharedSystemAlertCorrelation(
+ snap.ID,
+ AlertCorrelationRolePrimary,
+ "proxmox-connection-ownership",
+ )
+ }
if policyResourceID := strings.TrimSpace(snap.PolicyResourceID); policyResourceID != "" {
metadata["policyResourceID"] = policyResourceID
}
@@ -259,6 +267,7 @@ func (m *Manager) CheckConnection(snap ConnectionSnapshot) {
ResourceName: snap.Name,
Instance: snap.Name,
Message: message,
+ Correlation: correlation,
Metadata: metadata,
AddToRecent: true,
AddToHistory: true,
diff --git a/internal/alerts/correlation_test.go b/internal/alerts/correlation_test.go
new file mode 100644
index 0000000000..3975ce8171
--- /dev/null
+++ b/internal/alerts/correlation_test.go
@@ -0,0 +1,112 @@
+package alerts
+
+import (
+ "testing"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/models"
+)
+
+func TestNewSharedSystemAlertCorrelationFailsOpenOnIncompleteIdentity(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ key string
+ role AlertCorrelationRole
+ reason string
+ }{
+ {name: "missing key", role: AlertCorrelationRolePrimary, reason: "verified"},
+ {name: "missing reason", key: "pve:delly", role: AlertCorrelationRolePrimary},
+ {name: "unknown role", key: "pve:delly", role: AlertCorrelationRole("peer"), reason: "verified"},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ if got := NewSharedSystemAlertCorrelation(tc.key, tc.role, tc.reason); got != nil {
+ t.Fatalf("expected invalid correlation to fail open, got %+v", got)
+ }
+ })
+ }
+}
+
+func TestAlertCloneDoesNotShareCorrelation(t *testing.T) {
+ original := &Alert{
+ ID: "connection-alert",
+ Correlation: NewSharedSystemAlertCorrelation(
+ "pve:delly",
+ AlertCorrelationRolePrimary,
+ "proxmox-connection-ownership",
+ ),
+ }
+ clone := original.Clone()
+ if clone.Correlation == nil || clone.Correlation == original.Correlation {
+ t.Fatalf("expected independent correlation copy, got original=%p clone=%p", original.Correlation, clone.Correlation)
+ }
+ original.Correlation.Key = "pve:changed"
+ if clone.Correlation.Key != "pve:delly" {
+ t.Fatalf("clone correlation changed with original: %+v", clone.Correlation)
+ }
+}
+
+func TestAlertCloneDropsMalformedPersistedCorrelation(t *testing.T) {
+ for _, correlation := range []*AlertCorrelation{
+ {Key: "pve:delly", Kind: AlertCorrelationKind("causal"), Role: AlertCorrelationRolePrimary, Reason: "legacy"},
+ {Key: "pve:delly", Kind: AlertCorrelationKindSharedSystem, Role: AlertCorrelationRole("peer"), Reason: "legacy"},
+ {Key: "", Kind: AlertCorrelationKindSharedSystem, Role: AlertCorrelationRolePrimary, Reason: "legacy"},
+ } {
+ clone := (&Alert{ID: "persisted", Correlation: correlation}).Clone()
+ if clone.Correlation != nil {
+ t.Fatalf("malformed persisted correlation must fail open, got %+v", clone.Correlation)
+ }
+ }
+}
+
+func TestConnectivityAlertsRetainIndependentLifecyclesWithSharedSystemCorrelation(t *testing.T) {
+ m := newTestManager(t)
+ node := models.Node{ID: "node/delly/pve-1", Name: "pve-1", Instance: "delly"}
+ host := models.Host{ID: "agent-1", Hostname: "pve-1", DisplayName: "PVE Agent"}
+ hostCorrelation := NewSharedSystemAlertCorrelation(
+ "pve:delly",
+ AlertCorrelationRoleSupporting,
+ "verified-proxmox-node-agent-link",
+ )
+
+ for range 3 {
+ m.checkNodeOffline(node)
+ m.HandleHostOfflineWithCorrelation(host, hostCorrelation)
+ }
+
+ nodeAlert := testRequireActiveAlert(t, m, canonicalConnectivityStateID(node.ID))
+ hostAlert := testRequireActiveAlert(t, m, canonicalConnectivityStateID(hostResourceID(host.ID)))
+ if nodeAlert.ID == hostAlert.ID {
+ t.Fatal("shared-system signals must retain separate canonical alert identities")
+ }
+ for _, alert := range []*Alert{nodeAlert, hostAlert} {
+ if alert.Correlation == nil || alert.Correlation.Key != "pve:delly" {
+ t.Fatalf("alert %q missing shared-system correlation: %+v", alert.ID, alert.Correlation)
+ }
+ if alert.Correlation.Role != AlertCorrelationRoleSupporting {
+ t.Fatalf("alert %q role = %q, want supporting", alert.ID, alert.Correlation.Role)
+ }
+ }
+
+ m.HandleHostOnline(host)
+ if testHasActiveAlert(t, m, hostAlert.ID) {
+ t.Fatal("host recovery should resolve only the host detector lifecycle")
+ }
+ if !testHasActiveAlert(t, m, nodeAlert.ID) {
+ t.Fatal("host recovery must not resolve the still-firing node detector")
+ }
+}
+
+func TestPVEConnectionAlertIsSharedSystemPrimary(t *testing.T) {
+ m := newTestManager(t)
+ snap := platformConnectionSnapshot("pve:delly", "Delly", ConnectionStateUnreachable)
+ for range 3 {
+ m.CheckConnection(snap)
+ }
+
+ alert := testRequireActiveAlert(t, m, canonicalDiscreteStateStateID(snap.ID, connectionDegradedStateKey))
+ if alert.Correlation == nil {
+ t.Fatal("expected PVE connection correlation")
+ }
+ if alert.Correlation.Key != snap.ID || alert.Correlation.Role != AlertCorrelationRolePrimary {
+ t.Fatalf("unexpected PVE connection correlation: %+v", alert.Correlation)
+ }
+}
diff --git a/internal/alerts/host.go b/internal/alerts/host.go
index 1b3794557c..30a5bbdd7f 100644
--- a/internal/alerts/host.go
+++ b/internal/alerts/host.go
@@ -715,6 +715,13 @@ func (m *Manager) HandleHostTelemetryExpired(host models.Host) {
// HandleHostOffline raises an alert when a host agent stops reporting.
func (m *Manager) HandleHostOffline(host models.Host) {
+ m.HandleHostOfflineWithCorrelation(host, nil)
+}
+
+// HandleHostOfflineWithCorrelation raises a host connectivity alert with
+// optional verified shared-system context. The correlation affects only
+// presentation; the host alert retains its independent canonical lifecycle.
+func (m *Manager) HandleHostOfflineWithCorrelation(host models.Host, correlation *AlertCorrelation) {
if host.ID == "" {
return
}
@@ -781,6 +788,7 @@ func (m *Manager) HandleHostOffline(host models.Host) {
Node: nodeName,
Instance: instanceName,
Message: fmt.Sprintf("Host '%s' is offline", resourceName),
+ Correlation: correlation,
Metadata: map[string]interface{}{
"resourceType": "agent",
"hostId": host.ID,
diff --git a/internal/alerts/model.go b/internal/alerts/model.go
index a23e9ff193..b989c5a5ba 100644
--- a/internal/alerts/model.go
+++ b/internal/alerts/model.go
@@ -1,11 +1,61 @@
package alerts
import (
+ "strings"
"time"
"github.com/rcourtman/pulse-go-rewrite/internal/operationaltrust"
)
+type AlertCorrelationKind string
+
+const (
+ AlertCorrelationKindSharedSystem AlertCorrelationKind = "shared-system"
+)
+
+type AlertCorrelationRole string
+
+const (
+ AlertCorrelationRolePrimary AlertCorrelationRole = "primary"
+ AlertCorrelationRoleSupporting AlertCorrelationRole = "supporting"
+)
+
+// AlertCorrelation is presentation-only incident context. It lets clients
+// present independently evaluated alerts as signals from one verified system
+// without merging their canonical detector lifecycles.
+type AlertCorrelation struct {
+ Key string `json:"key"`
+ Kind AlertCorrelationKind `json:"kind"`
+ Role AlertCorrelationRole `json:"role"`
+ Reason string `json:"reason"`
+}
+
+// NewSharedSystemAlertCorrelation returns a bounded shared-system correlation.
+// Invalid or incomplete identity fails open so unrelated alerts remain separate.
+func NewSharedSystemAlertCorrelation(key string, role AlertCorrelationRole, reason string) *AlertCorrelation {
+ key = strings.TrimSpace(key)
+ reason = strings.TrimSpace(reason)
+ if key == "" || reason == "" {
+ return nil
+ }
+ if role != AlertCorrelationRolePrimary && role != AlertCorrelationRoleSupporting {
+ return nil
+ }
+ return &AlertCorrelation{
+ Key: key,
+ Kind: AlertCorrelationKindSharedSystem,
+ Role: role,
+ Reason: reason,
+ }
+}
+
+func cloneAlertCorrelation(correlation *AlertCorrelation) *AlertCorrelation {
+ if correlation == nil || correlation.Kind != AlertCorrelationKindSharedSystem {
+ return nil
+ }
+ return NewSharedSystemAlertCorrelation(correlation.Key, correlation.Role, correlation.Reason)
+}
+
// Alert represents an active alert
type Alert struct {
ID string `json:"id"`
@@ -27,6 +77,7 @@ type Alert struct {
Acknowledged bool `json:"acknowledged"`
AckTime *time.Time `json:"ackTime,omitempty"`
AckUser string `json:"ackUser,omitempty"`
+ Correlation *AlertCorrelation `json:"correlation,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
LastNotified *time.Time `json:"lastNotified,omitempty"`
LastEscalation int `json:"lastEscalation,omitempty"`
@@ -55,6 +106,10 @@ func (a *Alert) Clone() *Alert {
clone.LastNotified = &t
}
+ if a.Correlation != nil {
+ clone.Correlation = cloneAlertCorrelation(a.Correlation)
+ }
+
if len(a.EscalationTimes) > 0 {
clone.EscalationTimes = append([]time.Time(nil), a.EscalationTimes...)
}
diff --git a/internal/alerts/node.go b/internal/alerts/node.go
index 7c8d814145..346b28ef1f 100644
--- a/internal/alerts/node.go
+++ b/internal/alerts/node.go
@@ -242,6 +242,11 @@ func (m *Manager) resolveNodeDisplayName(instance, node string) string {
// checkNodeOffline creates an alert for offline nodes after confirmation
func (m *Manager) checkNodeOffline(node models.Node) {
alertID := fmt.Sprintf("node-offline-%s", node.ID)
+ correlation := NewSharedSystemAlertCorrelation(
+ "pve:"+strings.TrimSpace(node.Instance),
+ AlertCorrelationRoleSupporting,
+ "proxmox-node-membership",
+ )
m.mu.Lock()
m.mu.Unlock()
@@ -267,6 +272,7 @@ func (m *Manager) checkNodeOffline(node models.Node) {
Node: node.Name,
Instance: node.Instance,
Message: fmt.Sprintf("Node '%s' is offline", node.Name),
+ Correlation: correlation,
Metadata: map[string]interface{}{
"resourceType": "node",
"status": node.Status,
diff --git a/internal/monitoring/monitor_agents.go b/internal/monitoring/monitor_agents.go
index 8a44617bb1..0ecbd46c08 100644
--- a/internal/monitoring/monitor_agents.go
+++ b/internal/monitoring/monitor_agents.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/rcourtman/pulse-go-rewrite/internal/agentupdate"
+ "github.com/rcourtman/pulse-go-rewrite/internal/alerts"
"github.com/rcourtman/pulse-go-rewrite/internal/api/agentbinding"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/logging"
@@ -4502,6 +4503,7 @@ func hostAgentHealthWindow(interval int) time.Duration {
// evaluateHostAgents updates health for host agents based on last report time.
func (m *Monitor) evaluateHostAgents(now time.Time) {
hosts := m.state.GetHosts()
+ nodes := m.NodesSnapshot()
liveHostIDs := make(map[string]struct{}, len(hosts))
resourceRefreshNeeded := false
for _, host := range hosts {
@@ -4551,7 +4553,10 @@ func (m *Monitor) evaluateHostAgents(now time.Time) {
hostCopy.Status = "offline"
}
if m.alertManager != nil {
- m.alertManager.HandleHostOffline(hostCopy)
+ m.alertManager.HandleHostOfflineWithCorrelation(
+ hostCopy,
+ sharedSystemAlertCorrelationForHost(hostCopy, nodes),
+ )
}
}
}
@@ -4573,7 +4578,10 @@ func (m *Monitor) evaluateHostAgents(now time.Time) {
host := hostFromContinuityEntry(entry)
host.Status = "offline"
if m.alertManager != nil {
- m.alertManager.HandleHostOffline(host)
+ m.alertManager.HandleHostOfflineWithCorrelation(
+ host,
+ sharedSystemAlertCorrelationForHost(host, nodes),
+ )
}
}
@@ -4582,4 +4590,34 @@ func (m *Monitor) evaluateHostAgents(now time.Time) {
}
}
+func sharedSystemAlertCorrelationForHost(host models.Host, nodes []models.Node) *alerts.AlertCorrelation {
+ linkedNodeID := strings.TrimSpace(host.LinkedNodeID)
+ hostID := strings.TrimSpace(host.ID)
+ if linkedNodeID == "" || hostID == "" {
+ return nil
+ }
+
+ correlationKey := ""
+ for _, node := range nodes {
+ if strings.TrimSpace(node.ID) != linkedNodeID || strings.TrimSpace(node.LinkedAgentID) != hostID {
+ continue
+ }
+ instance := strings.TrimSpace(node.Instance)
+ if instance == "" {
+ return nil
+ }
+ candidate := "pve:" + instance
+ if correlationKey != "" && correlationKey != candidate {
+ return nil
+ }
+ correlationKey = candidate
+ }
+
+ return alerts.NewSharedSystemAlertCorrelation(
+ correlationKey,
+ alerts.AlertCorrelationRoleSupporting,
+ "verified-proxmox-node-agent-link",
+ )
+}
+
// sortContent sorts comma-separated content values for consistent display
diff --git a/internal/monitoring/monitor_host_agents_test.go b/internal/monitoring/monitor_host_agents_test.go
index a1e1cc99dc..1113ce1018 100644
--- a/internal/monitoring/monitor_host_agents_test.go
+++ b/internal/monitoring/monitor_host_agents_test.go
@@ -1378,6 +1378,33 @@ func TestEvaluateHostAgentsTriggersOfflineAlert(t *testing.T) {
}
}
+func TestSharedSystemAlertCorrelationForHostRequiresReciprocalNodeLink(t *testing.T) {
+ host := models.Host{ID: "agent-1", LinkedNodeID: "node-1"}
+ correlation := sharedSystemAlertCorrelationForHost(host, []models.Node{{
+ ID: "node-1",
+ Instance: "delly",
+ LinkedAgentID: "agent-1",
+ }})
+ if correlation == nil || correlation.Key != "pve:delly" {
+ t.Fatalf("expected reciprocal node-agent correlation, got %+v", correlation)
+ }
+
+ for _, nodes := range [][]models.Node{
+ nil,
+ {{ID: "node-1", Instance: "delly"}},
+ {{ID: "node-1", Instance: "delly", LinkedAgentID: "agent-2"}},
+ {{ID: "node-1", LinkedAgentID: "agent-1"}},
+ {
+ {ID: "node-1", Instance: "delly-a", LinkedAgentID: "agent-1"},
+ {ID: "node-1", Instance: "delly-b", LinkedAgentID: "agent-1"},
+ },
+ } {
+ if got := sharedSystemAlertCorrelationForHost(host, nodes); got != nil {
+ t.Fatalf("incomplete or conflicting link must fail open, got %+v", got)
+ }
+ }
+}
+
func TestEvaluateHostAgentsClearsAlertWhenHostReturns(t *testing.T) {
t.Helper()