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 Unraid storage health explanations

rcourtman31d07e74ce90
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index cd5d7617bf..fc8a089de1 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -198,6 +198,13 @@ redeclared in host-agent or settings-table branches. Host-profile detection is
an identity fact and must not depend on optional storage probes succeeding; an
Unraid host still reports the governed `unraid` profile and `linux` runtime
platform when `mdcmd` or array-topology collection is unavailable.
+Unraid array collection belongs to that same runtime-normalized agent path:
+`internal/hostagent/unraid.go` must treat empty `DISK_NP`/`DISK_NP_DSBL`
+slots with no device, id, filesystem, or size as unassigned topology
+placeholders rather than failed disks. Assigned disks may use `diskId`/`rdevId`
+as the serial fallback when Unraid does not expose a separate serial field, so
+monitoring receives stable disk identity without inventing host-profile or
+platform state from optional storage probe success.
First-class platform hosts that also run the Pulse Agent must keep the same
operator-facing system identity split: a Proxmox VE node may report a Debian
runtime platform underneath, but the host-agent OS identity and infrastructure
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 33fce7a3c3..c2d85c5821 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -168,6 +168,17 @@ legacy Unraid raw-status normalization at host-agent ingest: when older agents s
must derive the canonical disk status before storage-risk assessment runs so
v5 aggregate counters do not override clearly healthy per-disk state during v6
compatibility operation.
+The same monitoring compatibility boundary owns Unraid slot filtering and
+operator health posture after host-agent ingest. Empty no-present Unraid slots
+must be removed before storage-risk assessment so unassigned array capacity is
+not reported as missing or disabled media. An Unraid array with assigned data
+disks but no configured parity is an attention/warning posture with the
+machine-readable `unraid_no_parity` reason, while active parity check/sync
+state remains a separate `unraid_sync_active` reason. Realtime resource
+broadcasts must preserve canonical identity, discovery target, metrics target,
+incident rollups, and raw `agent`/`storage` facet payloads so frontend
+infrastructure surfaces can explain degraded/warning rows without falling back
+to generic status labels.
VMware vSphere now also has a locked phase-1 ingestion boundary under this
lane. The admitted direction is vCenter-only in phase 1, and monitoring must
stay API-first through the
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 21dcd15973..0ad24ad7da 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -184,6 +184,12 @@ regression protection.
`/auth/trial-activate` and `POST /api/license/trial/start` from public-path
and CSRF inventories must stay as constant-time route-table absence rather
than replacing the old callback with persistence-backed router probes.
+ Infrastructure host-table health explanations follow the same hot-path
+ rule. `UnifiedResourceHostTableCard.tsx` may render compact issue labels
+ from the already-materialized resource incident and storage-risk fields, but
+ it must not introduce per-row API reads, broad resource scans, storage
+ topology recomputation, or layout-measuring work just to explain warning or
+ degraded rows.
5. Extend workload hot-path filter, sort, grouping, and stats math through `frontend-modern/src/components/Workloads/workloadSelectors.ts`, and extend workload identity, discovery routing, and node-topology helpers through `frontend-modern/src/components/Workloads/workloadTopology.ts`, rather than duplicating selector or topology logic in `frontend-modern/src/components/Workloads/WorkloadsSurface.tsx`
The retired dashboard overview route must not return as a hot-path
orientation shortcut. First-viewport system count, health, source coverage,
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 10a9417bbe..b4fa1b7cbc 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -203,6 +203,13 @@ bypass the API fail-closed execution gate.
for healthy resources. Dependency impact belongs to impact summaries and
detail context, while `Primary Issue` must derive from explicit incidents,
storage risk summaries, or storage-risk reasons.
+ Unraid storage posture follows that same rule even when it reaches
+ infrastructure through the agent facet instead of the dedicated Storage
+ page: no-parity, parity-unavailable, disabled/missing disk, and sync/check
+ explanations must come from canonical `storage` or `agent.unraid`
+ storage-risk fields. Storage/recovery-adjacent consumers may render those
+ summaries, but they must not infer Unraid array health from generic
+ frontend status labels or from empty no-present slots.
4. Route transport changes for storage and recovery endpoints through `internal/api/` and the owning `api-contracts` proof routes
Shared API-token transport helpers may be consumed by storage/recovery-
adjacent flows, but `owner_user_id` remains server-authored token identity
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index b0ebfd1af0..3eb3e059dc 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -186,6 +186,14 @@ cross-source deduplication.
the shared `Table` wrapper rather than drawer-local scroll divs. This
includes both current resource drawers and legacy PMG resource panels that
still consume unified-resource PMG state.
+ Realtime resource payloads are part of the same consumer contract as REST:
+ websocket broadcasts must carry canonical identity, discovery targets,
+ metrics targets, incident rollups, facet counts, and source-specific raw
+ facets such as `agent`, `storage`, `docker`, and provider API facets. Host
+ rows and drawers may present compact issue labels such as Unraid
+ no-parity posture, but those labels must derive from canonical incident or
+ storage-risk summaries already present on the resource rather than local
+ platform heuristics or generic status-only wording.
Resource detail mappers now reuse the shared
`frontend-modern/src/utils/textPresentation.ts` title-case helper for sensor
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index 11657226b9..84e277ecd8 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -69,6 +69,16 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
</span>
)}
</For>
+ <Show when={drawer.healthIssue()}>
+ {(issue) => (
+ <span
+ class="inline-flex max-w-full items-center rounded bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-900 dark:text-amber-300"
+ title={issue().title}
+ >
+ {issue().compactLabel}
+ </span>
+ )}
+ </Show>
</div>
</div>
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
index fd664e9bed..fbbdd0dd7b 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
@@ -115,6 +115,32 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver
{resource.status || 'unknown'}
</span>
</div>
+ <Show when={drawer.healthIssue()}>
+ {(issue) => (
+ <>
+ <div class="flex items-start justify-between gap-2">
+ <span class="shrink-0 text-muted">Reason</span>
+ <span
+ class="max-w-[68%] text-right font-medium text-amber-700 dark:text-amber-300"
+ title={issue().title}
+ >
+ {issue().primary}
+ </span>
+ </div>
+ <Show when={issue().details.length > 0}>
+ <div class="flex items-start justify-between gap-2">
+ <span class="shrink-0 text-muted">Also</span>
+ <span
+ class="max-w-[68%] text-right font-medium text-base-content"
+ title={issue().details.join(' · ')}
+ >
+ {issue().details.slice(0, 2).join(' · ')}
+ </span>
+ </div>
+ </Show>
+ </>
+ )}
+ </Show>
<Show when={resource.uptime}>
<div class="flex items-center justify-between gap-2">
<span class="text-muted">Uptime</span>
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
index 00533bf62c..4d8f5b6db2 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
@@ -40,6 +40,7 @@ import {
} from '@/utils/resourcePolicyPresentation';
import { getAvailabilityProbePresentation } from '@/utils/availabilityProbePresentation';
import { ResourceDetailDrawer } from './ResourceDetailDrawer';
+import { getResourceHealthIssuePresentation } from './resourceHealthPresentation';
import { buildWorkloadsHref } from './workloadsLink';
import { ClusterDeployBanner } from './ClusterDeployBanner';
import { ResourceFacetSummary } from './ResourceFacetSummary';
@@ -238,6 +239,7 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
const statusIndicator = createMemo(() =>
getAgentStatusIndicator({ status: resource.status }),
);
+ const healthIssue = createMemo(() => getResourceHealthIssuePresentation(resource));
const metricsKey = createMemo(() => buildMetricKeyForUnifiedResource(resource));
const alertResourceIdCandidates = createMemo(() =>
hostOverrideIdCandidates(resource),
@@ -369,8 +371,8 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
/>
<StatusDot
variant={statusIndicator().variant}
- title={statusIndicator().label}
- ariaLabel={statusIndicator().label}
+ title={healthIssue()?.title || statusIndicator().label}
+ ariaLabel={healthIssue()?.title || statusIndicator().label}
size="xs"
/>
<div class="flex min-w-0 flex-1 flex-col">
@@ -381,6 +383,16 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
>
{displayName()}
</span>
+ <Show when={healthIssue()}>
+ {(issue) => (
+ <span
+ class="hidden shrink-0 whitespace-nowrap rounded bg-amber-100 px-1 text-[9px] font-medium text-amber-700 dark:bg-amber-900 dark:text-amber-300 lg:inline"
+ title={issue().title}
+ >
+ {issue().compactLabel}
+ </span>
+ )}
+ </Show>
<Show when={shouldShowResourceAlternateName(resource)}>
<span class="hidden min-w-0 max-w-[28%] shrink truncate text-[9px] text-muted lg:inline">
({resource.name})
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
index 176132c2e7..12db1e5a1f 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
@@ -137,6 +137,23 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(within(headerBadges).getByText('PVE')).toBeInTheDocument();
});
+ it('explains degraded host storage posture in the current state card', () => {
+ const resource = baseResource({
+ status: 'degraded',
+ agent: {
+ storagePostureSummary: 'Unraid array is running without parity protection',
+ rebuildSummary: 'Unraid array is running check',
+ },
+ });
+
+ const { getByText } = render(() => <ResourceDetailDrawer resource={resource} />);
+
+ expect(getByText('No parity')).toBeInTheDocument();
+ expect(getByText('Reason')).toBeInTheDocument();
+ expect(getByText('Unraid array is running without parity protection')).toBeInTheDocument();
+ expect(getByText('Unraid array is running check')).toBeInTheDocument();
+ });
+
it('keeps discovery as secondary overview context instead of a peer tab', async () => {
const { getByRole, getByText, getByTestId, queryByRole, queryByTestId, queryByText } = render(
() => <ResourceDetailDrawer resource={baseResource({})} />,
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
index 8d6258db2d..300e2420c5 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
@@ -222,6 +222,34 @@ describe('UnifiedResourceTable performance contract', () => {
expect(queryByText('Docker')).toBeNull();
});
+ it('renders compact canonical health reasons without replacing host identity', async () => {
+ const resources = [
+ makeResource(1, {
+ type: 'agent',
+ displayName: 'Tower',
+ status: 'degraded',
+ agent: {
+ storagePostureSummary: 'Unraid array is running without parity protection',
+ rebuildSummary: 'Unraid array is running check',
+ },
+ }),
+ ];
+
+ const { getByText } = render(() => (
+ <UnifiedResourceTable
+ resources={resources}
+ expandedResourceId={null}
+ onExpandedResourceChange={vi.fn()}
+ groupingMode="flat"
+ />
+ ));
+
+ await waitFor(() => {
+ expect(getByText('Tower')).toBeInTheDocument();
+ expect(getByText('No parity')).toBeInTheDocument();
+ });
+ });
+
it('surfaces availability probe evidence directly in network endpoint rows', async () => {
vi.spyOn(Date, 'now').mockReturnValue(new Date('2026-05-06T13:00:20Z').getTime());
const resources = [
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceHealthPresentation.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceHealthPresentation.test.ts
new file mode 100644
index 0000000000..b9419ea04e
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceHealthPresentation.test.ts
@@ -0,0 +1,62 @@
+import { describe, expect, it } from 'vitest';
+import type { Resource } from '@/types/resource';
+import { getResourceHealthIssuePresentation } from '../resourceHealthPresentation';
+
+const makeResource = (overrides: Partial<Resource> = {}): Resource =>
+ ({
+ id: 'agent-tower',
+ type: 'agent',
+ name: 'Tower',
+ displayName: 'Tower',
+ platformId: 'tower',
+ platformType: 'agent',
+ sourceType: 'agent',
+ status: 'degraded',
+ lastSeen: Date.now(),
+ ...overrides,
+ }) as Resource;
+
+describe('resource health presentation', () => {
+ it('surfaces host storage posture as the visible degraded reason', () => {
+ const resource = makeResource({
+ agent: {
+ storagePostureSummary: 'Unraid array is running without parity protection',
+ rebuildSummary: 'Unraid array is running check',
+ unraid: {
+ risk: {
+ level: 'warning',
+ reasons: [
+ {
+ code: 'unraid_no_parity',
+ severity: 'warning',
+ summary: 'Unraid array is running without parity protection',
+ },
+ {
+ code: 'unraid_sync_active',
+ severity: 'warning',
+ summary: 'Unraid array is running check',
+ },
+ ],
+ },
+ },
+ },
+ });
+
+ expect(getResourceHealthIssuePresentation(resource)).toMatchObject({
+ primary: 'Unraid array is running without parity protection',
+ compactLabel: 'No parity',
+ details: ['Unraid array is running check'],
+ });
+ });
+
+ it('does not add warning copy to healthy resources', () => {
+ const resource = makeResource({
+ status: 'online',
+ agent: {
+ storagePostureSummary: 'Unraid array is running without parity protection',
+ },
+ });
+
+ expect(getResourceHealthIssuePresentation(resource)).toBeNull();
+ });
+});
diff --git a/frontend-modern/src/components/Infrastructure/resourceHealthPresentation.ts b/frontend-modern/src/components/Infrastructure/resourceHealthPresentation.ts
new file mode 100644
index 0000000000..64ddd65688
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/resourceHealthPresentation.ts
@@ -0,0 +1,100 @@
+import type { Resource, ResourceStorageRisk } from '@/types/resource';
+
+export interface ResourceHealthIssuePresentation {
+ primary: string;
+ compactLabel: string;
+ details: string[];
+ title: string;
+}
+
+type AgentStorageLike = NonNullable<Resource['agent']> & {
+ unraid?: {
+ risk?: ResourceStorageRisk;
+ riskSummary?: string;
+ postureSummary?: string;
+ protectionSummary?: string;
+ rebuildSummary?: string;
+ };
+};
+
+const ATTENTION_STATUSES = new Set([
+ 'degraded',
+ 'warning',
+ 'critical',
+ 'faulted',
+ 'failed',
+ 'error',
+ 'unhealthy',
+ 'offline',
+ 'down',
+ 'unavailable',
+]);
+
+const trimSummary = (value: string | undefined | null): string => (value || '').trim();
+
+const pushUnique = (items: string[], value: string | undefined | null) => {
+ const trimmed = trimSummary(value);
+ if (!trimmed) return;
+ if (!items.some((item) => item.toLowerCase() === trimmed.toLowerCase())) {
+ items.push(trimmed);
+ }
+};
+
+const pushRiskReasons = (items: string[], risk: ResourceStorageRisk | undefined) => {
+ for (const reason of risk?.reasons ?? []) {
+ pushUnique(items, reason.summary);
+ }
+};
+
+const compactHealthLabel = (summary: string): string => {
+ const normalized = summary.toLowerCase();
+ if (normalized.includes('without parity protection')) return 'No parity';
+ if (normalized.includes('parity protection') && normalized.includes('unavailable')) {
+ return 'Parity unavailable';
+ }
+ if (normalized.includes('parity') && normalized.includes('missing')) return 'Parity missing';
+ if (normalized.includes('array is running check')) return 'Array check running';
+ if (summary.length <= 34) return summary;
+ return `${summary.slice(0, 31).trimEnd()}...`;
+};
+
+export const getResourceHealthIssuePresentation = (
+ resource: Resource,
+): ResourceHealthIssuePresentation | null => {
+ const status = (resource.status || '').trim().toLowerCase();
+ const summaries: string[] = [];
+
+ pushUnique(summaries, resource.incidentSummary);
+ pushUnique(summaries, resource.incidentLabel);
+
+ pushUnique(summaries, resource.storage?.postureSummary);
+ pushUnique(summaries, resource.storage?.riskSummary);
+ pushUnique(summaries, resource.storage?.protectionSummary);
+ pushUnique(summaries, resource.storage?.rebuildSummary);
+ pushRiskReasons(summaries, resource.storage?.risk);
+
+ const agent = resource.agent as AgentStorageLike | undefined;
+ pushUnique(summaries, agent?.storagePostureSummary);
+ pushUnique(summaries, agent?.storageRiskSummary);
+ pushUnique(summaries, agent?.protectionSummary);
+ pushUnique(summaries, agent?.rebuildSummary);
+ pushRiskReasons(summaries, agent?.storageRisk);
+ pushUnique(summaries, agent?.unraid?.postureSummary);
+ pushUnique(summaries, agent?.unraid?.riskSummary);
+ pushUnique(summaries, agent?.unraid?.protectionSummary);
+ pushUnique(summaries, agent?.unraid?.rebuildSummary);
+ pushRiskReasons(summaries, agent?.unraid?.risk);
+
+ if (summaries.length === 0 || !ATTENTION_STATUSES.has(status)) {
+ return null;
+ }
+
+ const [primary, ...details] = summaries;
+ const compactLabel = compactHealthLabel(primary);
+ return {
+ primary,
+ compactLabel,
+ details: details.filter((detail) => detail.toLowerCase() !== primary.toLowerCase()),
+ title: [primary, ...details].join(' · '),
+ };
+};
diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
index cdb91e0e7e..8471609548 100644
--- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
+++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
@@ -64,6 +64,7 @@ import {
buildVMwareDetailsSummary,
buildVMwareDetailSections,
} from './resourceDetailDrawerVmwareModel';
+import { getResourceHealthIssuePresentation } from './resourceHealthPresentation';
type DrawerTab = 'overview' | 'mail' | 'namespaces' | 'deployments' | 'swarm' | 'debug';
@@ -90,6 +91,7 @@ export const useResourceDetailDrawerDerivedState = (
const resolveResourceLabel = (resourceId: string): string =>
resolveResourceLabelInput?.(resourceId)?.trim() || resourceId;
const statusIndicator = createMemo(() => getAgentStatusIndicator({ status: resource.status }));
+ const healthIssue = createMemo(() => getResourceHealthIssuePresentation(resource));
const lastSeen = createMemo(() => formatRelativeTime(resource.lastSeen));
const lastSeenAbsolute = createMemo(() => formatAbsoluteTime(resource.lastSeen));
@@ -322,6 +324,7 @@ export const useResourceDetailDrawerDerivedState = (
kubernetesClusterName,
resolveResourceLabel,
statusIndicator,
+ healthIssue,
lastSeen,
lastSeenAbsolute,
platformBadge,
diff --git a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
index 0de40b7c44..d2396e46ef 100644
--- a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
@@ -221,6 +221,35 @@ describe('useUnifiedResources', () => {
[
createWsResource({
cpu: { current: 42 },
+ status: 'degraded',
+ incidentSummary: 'Unraid array is running without parity protection',
+ canonicalIdentity: {
+ primaryId: 'agent:host-1',
+ hostname: 'pve1',
+ },
+ metricsTarget: {
+ resourceType: 'agent',
+ resourceId: 'host-1',
+ },
+ agent: {
+ storagePostureSummary: 'Unraid array is running without parity protection',
+ rebuildSummary: 'Unraid array is running check',
+ unraid: {
+ risk: {
+ level: 'warning',
+ reasons: [
+ {
+ code: 'unraid_no_parity',
+ severity: 'warning',
+ summary: 'Unraid array is running without parity protection',
+ },
+ ],
+ },
+ },
+ },
+ storage: {
+ postureSummary: 'Unraid array is running without parity protection',
+ },
}),
],
{ key: 'id' },
@@ -241,6 +270,23 @@ describe('useUnifiedResources', () => {
expect(result!.resources()[0].facetCounts).toEqual({
recentChanges: 1,
});
+ expect(result!.resources()[0].canonicalIdentity?.primaryId).toBe('agent:host-1');
+ expect(result!.resources()[0].metricsTarget).toEqual({
+ resourceType: 'agent',
+ resourceId: 'host-1',
+ });
+ expect(result!.resources()[0].incidentSummary).toBe(
+ 'Unraid array is running without parity protection',
+ );
+ expect(result!.resources()[0].agent?.storagePostureSummary).toBe(
+ 'Unraid array is running without parity protection',
+ );
+ expect(result!.resources()[0].agent?.unraid?.risk?.reasons?.[0]?.code).toBe(
+ 'unraid_no_parity',
+ );
+ expect(result!.resources()[0].storage?.postureSummary).toBe(
+ 'Unraid array is running without parity protection',
+ );
dispose();
});
diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.ts
index 0fa74a08ec..947b19acbc 100644
--- a/frontend-modern/src/hooks/useUnifiedResources.ts
+++ b/frontend-modern/src/hooks/useUnifiedResources.ts
@@ -8,6 +8,7 @@ import { asTrimmedString } from '@/utils/stringUtils';
import { getGlobalWebSocketStore } from '@/stores/websocket-global';
import type {
Resource,
+ ResourceAgentUnraidMeta,
ResourceChange,
ResourceFacetCounts,
ResourceDiscoveryTarget,
@@ -17,6 +18,7 @@ import type {
ResourcePolicyPostureSummary,
ResourceStatus,
ResourceStorageMeta,
+ ResourceStorageRisk,
ResourceType,
ResourceVMwareMeta,
} from '@/types/resource';
@@ -191,6 +193,14 @@ type APIResource = {
disks?: APIAgentDiskInfo[];
sensors?: APIAgentSensorSummary;
raid?: APIHostRAIDArray[];
+ unraid?: ResourceAgentUnraidMeta;
+ storageRisk?: ResourceStorageRisk;
+ storageRiskSummary?: string;
+ storagePostureSummary?: string;
+ protectionReduced?: boolean;
+ protectionSummary?: string;
+ rebuildInProgress?: boolean;
+ rebuildSummary?: string;
commandsEnabled?: boolean;
tokenId?: string;
tokenName?: string;
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index 32ba0104c5..a7b95f72d0 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -399,6 +399,38 @@ export interface ResourceAgentDisk {
free?: number;
}
+export interface ResourceAgentUnraidDisk {
+ name?: string;
+ device?: string;
+ role?: string;
+ status?: string;
+ rawStatus?: string;
+ serial?: string;
+ filesystem?: string;
+ sizeBytes?: number;
+ slot?: number;
+}
+
+export interface ResourceAgentUnraidMeta {
+ arrayStarted?: boolean;
+ arrayState?: string;
+ syncAction?: string;
+ syncProgress?: number;
+ syncErrors?: number;
+ numProtected?: number;
+ numDisabled?: number;
+ numInvalid?: number;
+ numMissing?: number;
+ disks?: ResourceAgentUnraidDisk[];
+ risk?: ResourceStorageRisk;
+ riskSummary?: string;
+ postureSummary?: string;
+ protectionReduced?: boolean;
+ protectionSummary?: string;
+ rebuildInProgress?: boolean;
+ rebuildSummary?: string;
+}
+
export interface ResourceAgentMeta {
agentId?: string;
agentVersion?: string;
@@ -416,6 +448,14 @@ export interface ResourceAgentMeta {
disks?: ResourceAgentDisk[];
sensors?: HostSensorSummary;
raid?: HostRAIDArray[];
+ unraid?: ResourceAgentUnraidMeta;
+ storageRisk?: ResourceStorageRisk;
+ storageRiskSummary?: string;
+ storagePostureSummary?: string;
+ protectionReduced?: boolean;
+ protectionSummary?: string;
+ rebuildInProgress?: boolean;
+ rebuildSummary?: string;
commandsEnabled?: boolean;
tokenId?: string;
tokenName?: string;
diff --git a/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts b/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts
index 0c56c52c6d..d2e958af08 100644
--- a/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts
@@ -350,4 +350,47 @@ describe('resourceStateAdapters nodeFromResource', () => {
});
expect(merged.clusterId).toBe('Core Fabric');
});
+
+ it('preserves canonical health context from realtime resources', () => {
+ const [agent] = mergeCanonicalResourceSnapshot(
+ [
+ {
+ id: 'agent:tower',
+ type: 'agent',
+ name: 'Tower',
+ displayName: 'Tower',
+ platformId: 'agent-1',
+ platformType: 'agent',
+ sourceType: 'agent',
+ status: 'degraded',
+ lastSeen: Date.now(),
+ incidentSummary: 'Unraid array is running without parity protection',
+ agent: {
+ osName: 'Unraid',
+ storagePostureSummary: 'Unraid array is running without parity protection',
+ unraid: {
+ postureSummary: 'Unraid array is running without parity protection',
+ risk: {
+ level: 'warning',
+ reasons: [
+ {
+ code: 'unraid_no_parity',
+ severity: 'warning',
+ summary: 'Unraid array is running without parity protection',
+ },
+ ],
+ },
+ },
+ },
+ } as Resource,
+ ],
+ [],
+ );
+
+ expect(agent.incidentSummary).toBe('Unraid array is running without parity protection');
+ expect(agent.agent?.storagePostureSummary).toBe(
+ 'Unraid array is running without parity protection',
+ );
+ expect(agent.agent?.unraid?.risk?.reasons?.[0]?.code).toBe('unraid_no_parity');
+ });
});
diff --git a/internal/hostagent/agent_metrics_test.go b/internal/hostagent/agent_metrics_test.go
index 3e7ec8890e..643b852eeb 100644
--- a/internal/hostagent/agent_metrics_test.go
+++ b/internal/hostagent/agent_metrics_test.go
@@ -254,6 +254,42 @@ func TestBuildReport(t *testing.T) {
mc.unraidStorageFn = nil
})
+ t.Run("Unraid parser skips empty no-present slots", func(t *testing.T) {
+ storage, err := parseUnraidStatusOutput(`
+mdState=STARTED
+diskNumber.0=0
+diskName.0=
+diskSize.0=0
+rdevStatus.0=DISK_NP_DSBL
+rdevName.0=
+diskId.0=
+rdevId.0=
+diskNumber.1=1
+diskName.1=md1p1
+diskSize.1=5860522532
+rdevStatus.1=DISK_OK
+rdevName.1=sde
+diskId.1=WDC_DATA
+rdevId.1=WDC_DATA
+diskNumber.29=29
+diskName.29=
+diskSize.29=0
+rdevStatus.29=DISK_NP
+rdevName.29=
+diskId.29=
+rdevId.29=
+`)
+ if err != nil {
+ t.Fatalf("parseUnraidStatusOutput() error = %v", err)
+ }
+ if len(storage.Disks) != 1 {
+ t.Fatalf("disk count = %d, want assigned slots only: %+v", len(storage.Disks), storage.Disks)
+ }
+ if got := storage.Disks[0]; got.Device != "/dev/sde" || got.Serial != "WDC_DATA" {
+ t.Fatalf("assigned disk = %+v, want device /dev/sde with serial fallback", got)
+ }
+ })
+
// Test case 6: SMART collection
t.Run("SMART collection", func(t *testing.T) {
mc.smartLocalFn = func(_ context.Context, _ []string) ([]DiskSMART, error) {
diff --git a/internal/hostagent/unraid.go b/internal/hostagent/unraid.go
index eaa06f1161..12e9a54319 100644
--- a/internal/hostagent/unraid.go
+++ b/internal/hostagent/unraid.go
@@ -99,13 +99,16 @@ func parseUnraidStatusOutput(output string) (*agentshost.UnraidStorage, error) {
Name: strings.TrimSpace(fields[fmt.Sprintf("diskName.%d", idx)]),
Device: normalizeBlockDevice(firstNonEmpty(fields[fmt.Sprintf("rdevName.%d", idx)], fields[fmt.Sprintf("diskDevice.%d", idx)])),
RawStatus: strings.TrimSpace(firstNonEmpty(fields[fmt.Sprintf("rdevStatus.%d", idx)], fields[fmt.Sprintf("diskState.%d", idx)])),
- Serial: strings.TrimSpace(firstNonEmpty(fields[fmt.Sprintf("rdevSerial.%d", idx)], fields[fmt.Sprintf("diskSerial.%d", idx)])),
+ Serial: strings.TrimSpace(firstNonEmpty(fields[fmt.Sprintf("rdevSerial.%d", idx)], fields[fmt.Sprintf("diskSerial.%d", idx)], fields[fmt.Sprintf("rdevId.%d", idx)], fields[fmt.Sprintf("diskId.%d", idx)])),
Filesystem: strings.TrimSpace(firstNonEmpty(fields[fmt.Sprintf("diskFsType.%d", idx)], fields[fmt.Sprintf("fsType.%d", idx)])),
SizeBytes: parseFirstInt64(fields[fmt.Sprintf("diskSize.%d", idx)], fields[fmt.Sprintf("rdevSize.%d", idx)]),
Slot: idx,
}
disk.Role = inferUnraidDiskRole(disk.Name, idx)
disk.Status = normalizeUnraidDiskStatus(disk.RawStatus, disk.Device)
+ if isUnraidEmptySlot(disk) {
+ continue
+ }
if disk.Name == "" {
disk.Name = defaultUnraidDiskName(disk.Role, idx)
}
@@ -148,9 +151,11 @@ func collectUnraidIndexes(fields map[string]string) []int {
"diskSize.",
"diskState.",
"diskFsType.",
+ "diskId.",
"rdevName.",
"rdevStatus.",
"rdevSerial.",
+ "rdevId.",
}
for key := range fields {
@@ -218,6 +223,19 @@ func defaultUnraidDiskName(role string, idx int) string {
}
}
+func isUnraidEmptySlot(disk agentshost.UnraidDisk) bool {
+ rawStatus := strings.ToUpper(strings.TrimSpace(disk.RawStatus))
+ status := strings.ToLower(strings.TrimSpace(disk.Status))
+ if !strings.Contains(rawStatus, "DISK_NP") && status != "missing" {
+ return false
+ }
+ return strings.TrimSpace(disk.Name) == "" &&
+ strings.TrimSpace(disk.Device) == "" &&
+ strings.TrimSpace(disk.Serial) == "" &&
+ strings.TrimSpace(disk.Filesystem) == "" &&
+ disk.SizeBytes == 0
+}
+
func normalizeUnraidDiskStatus(raw string, device string) string {
status := strings.ToUpper(strings.TrimSpace(raw))
switch {
diff --git a/internal/hostagent/unraid_test.go b/internal/hostagent/unraid_test.go
index ca029a1b35..401de98925 100644
--- a/internal/hostagent/unraid_test.go
+++ b/internal/hostagent/unraid_test.go
@@ -60,6 +60,54 @@ rdevStatus.2=DISK_DSBL
}
}
+func TestParseUnraidStatusOutputSkipsEmptyNoPresentSlots(t *testing.T) {
+ output := `
+mdState=STARTED
+mdNumDisabled=2
+mdNumInvalid=2
+mdNumMissing=0
+diskNumber.0=0
+diskName.0=
+diskSize.0=0
+diskId.0=
+rdevStatus.0=DISK_NP_DSBL
+rdevName.0=
+rdevId.0=
+diskNumber.1=1
+diskName.1=md1p1
+diskSize.1=5860522532
+diskId.1=WDC_DATA
+rdevStatus.1=DISK_OK
+rdevName.1=sde
+rdevId.1=WDC_DATA
+diskNumber.5=5
+diskName.5=
+diskSize.5=0
+diskId.5=
+rdevStatus.5=DISK_NP
+rdevName.5=
+rdevId.5=
+diskNumber.29=29
+diskName.29=
+diskSize.29=0
+diskId.29=
+rdevStatus.29=DISK_NP_DSBL
+rdevName.29=
+rdevId.29=
+`
+
+ storage, err := parseUnraidStatusOutput(output)
+ if err != nil {
+ t.Fatalf("parseUnraidStatusOutput() error = %v", err)
+ }
+ if len(storage.Disks) != 1 {
+ t.Fatalf("disk count = %d, want only assigned disks: %+v", len(storage.Disks), storage.Disks)
+ }
+ if got := storage.Disks[0]; got.Name != "md1p1" || got.Status != "online" || got.Serial != "WDC_DATA" {
+ t.Fatalf("unexpected assigned disk: %+v", got)
+ }
+}
+
func TestCollectUnraidStorageSkipsNonUnraid(t *testing.T) {
t.Parallel()
diff --git a/internal/models/converters.go b/internal/models/converters.go
index be16b91b69..c9f25d0813 100644
--- a/internal/models/converters.go
+++ b/internal/models/converters.go
@@ -902,30 +902,63 @@ func zeroIfNegative(val int64) int64 {
// This function is in models package to avoid circular imports.
// It takes individual fields rather than the whole Resource to avoid importing resources package.
type ResourceConvertInput struct {
- ID string
- Type string
- Name string
- DisplayName string
- PlatformID string
- PlatformType string
- SourceType string
- ParentID string
- ClusterID string
- Status string
- CPU *ResourceMetricInput
- Memory *ResourceMetricInput
- Disk *ResourceMetricInput
- NetworkRX int64
- NetworkTX int64
- HasNetwork bool
- Temperature *float64
- Uptime *int64
- Tags []string
- Labels map[string]string
- LastSeenUnix int64
- Alerts []ResourceAlertInput
- Identity *ResourceIdentityInput
- PlatformData json.RawMessage
+ ID string
+ Type string
+ Technology string
+ Name string
+ DisplayName string
+ PlatformID string
+ PlatformType string
+ SourceType string
+ ParentID string
+ ClusterID string
+ Status string
+ CPU *ResourceMetricInput
+ Memory *ResourceMetricInput
+ Disk *ResourceMetricInput
+ NetworkRX int64
+ NetworkTX int64
+ HasNetwork bool
+ Temperature *float64
+ Uptime *int64
+ Tags []string
+ Labels map[string]string
+ LastSeenUnix int64
+ Alerts []ResourceAlertInput
+ IncidentCount int
+ IncidentCode string
+ IncidentSeverity string
+ IncidentSummary string
+ IncidentCategory string
+ IncidentLabel string
+ IncidentPriority int
+ IncidentImpactSummary string
+ IncidentUrgency string
+ IncidentAction string
+ Identity *ResourceIdentityInput
+ DiscoveryTarget json.RawMessage
+ MetricsTarget json.RawMessage
+ Canonical json.RawMessage
+ Policy json.RawMessage
+ AISafeSummary string
+ Capabilities json.RawMessage
+ Relationships json.RawMessage
+ RecentChanges json.RawMessage
+ FacetCounts json.RawMessage
+ Incidents json.RawMessage
+ Proxmox json.RawMessage
+ Storage json.RawMessage
+ Agent json.RawMessage
+ Docker json.RawMessage
+ PBS json.RawMessage
+ PMG json.RawMessage
+ Kubernetes json.RawMessage
+ PhysicalDisk json.RawMessage
+ Ceph json.RawMessage
+ TrueNAS json.RawMessage
+ VMware json.RawMessage
+ Availability json.RawMessage
+ PlatformData json.RawMessage
}
// ResourceMetricInput represents a metric value for resource conversion.
@@ -955,22 +988,55 @@ type ResourceIdentityInput struct {
// ConvertResourceToFrontend converts input to ResourceFrontend.
func ConvertResourceToFrontend(input ResourceConvertInput) ResourceFrontend {
rf := ResourceFrontend{
- ID: input.ID,
- Type: input.Type,
- Name: input.Name,
- DisplayName: input.DisplayName,
- PlatformID: input.PlatformID,
- PlatformType: input.PlatformType,
- SourceType: input.SourceType,
- ParentID: input.ParentID,
- ClusterID: input.ClusterID,
- Status: input.Status,
- Temperature: input.Temperature,
- Uptime: input.Uptime,
- Tags: append([]string(nil), input.Tags...),
- Labels: nil,
- LastSeen: input.LastSeenUnix,
- PlatformData: input.PlatformData,
+ ID: input.ID,
+ Type: input.Type,
+ Technology: input.Technology,
+ Name: input.Name,
+ DisplayName: input.DisplayName,
+ PlatformID: input.PlatformID,
+ PlatformType: input.PlatformType,
+ SourceType: input.SourceType,
+ ParentID: input.ParentID,
+ ClusterID: input.ClusterID,
+ Status: input.Status,
+ Temperature: input.Temperature,
+ Uptime: input.Uptime,
+ Tags: append([]string(nil), input.Tags...),
+ Labels: nil,
+ LastSeen: input.LastSeenUnix,
+ IncidentCount: input.IncidentCount,
+ IncidentCode: input.IncidentCode,
+ IncidentSeverity: input.IncidentSeverity,
+ IncidentSummary: input.IncidentSummary,
+ IncidentCategory: input.IncidentCategory,
+ IncidentLabel: input.IncidentLabel,
+ IncidentPriority: input.IncidentPriority,
+ IncidentImpactSummary: input.IncidentImpactSummary,
+ IncidentUrgency: input.IncidentUrgency,
+ IncidentAction: input.IncidentAction,
+ DiscoveryTarget: input.DiscoveryTarget,
+ MetricsTarget: input.MetricsTarget,
+ Canonical: input.Canonical,
+ Policy: input.Policy,
+ AISafeSummary: input.AISafeSummary,
+ Capabilities: input.Capabilities,
+ Relationships: input.Relationships,
+ RecentChanges: input.RecentChanges,
+ FacetCounts: input.FacetCounts,
+ Incidents: input.Incidents,
+ Proxmox: input.Proxmox,
+ Storage: input.Storage,
+ Agent: input.Agent,
+ Docker: input.Docker,
+ PBS: input.PBS,
+ PMG: input.PMG,
+ Kubernetes: input.Kubernetes,
+ PhysicalDisk: input.PhysicalDisk,
+ Ceph: input.Ceph,
+ TrueNAS: input.TrueNAS,
+ VMware: input.VMware,
+ Availability: input.Availability,
+ PlatformData: input.PlatformData,
}
if len(input.Labels) > 0 {
diff --git a/internal/models/models_frontend.go b/internal/models/models_frontend.go
index 4381f0c97f..64bdecce51 100644
--- a/internal/models/models_frontend.go
+++ b/internal/models/models_frontend.go
@@ -873,6 +873,7 @@ type ResourceFrontend struct {
// Identity
ID string `json:"id"`
Type string `json:"type"`
+ Technology string `json:"technology,omitempty"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
@@ -900,9 +901,43 @@ type ResourceFrontend struct {
LastSeen int64 `json:"lastSeen"` // Unix milliseconds
Alerts []ResourceAlertFrontend `json:"alerts"`
+ IncidentCount int `json:"incidentCount,omitempty"`
+ IncidentCode string `json:"incidentCode,omitempty"`
+ IncidentSeverity string `json:"incidentSeverity,omitempty"`
+ IncidentSummary string `json:"incidentSummary,omitempty"`
+ IncidentCategory string `json:"incidentCategory,omitempty"`
+ IncidentLabel string `json:"incidentLabel,omitempty"`
+ IncidentPriority int `json:"incidentPriority,omitempty"`
+ IncidentImpactSummary string `json:"incidentImpactSummary,omitempty"`
+ IncidentUrgency string `json:"incidentUrgency,omitempty"`
+ IncidentAction string `json:"incidentAction,omitempty"`
+
// Identity for deduplication
Identity *ResourceIdentityFrontend `json:"identity,omitempty"`
+ DiscoveryTarget json.RawMessage `json:"discoveryTarget,omitempty"`
+ MetricsTarget json.RawMessage `json:"metricsTarget,omitempty"`
+ Canonical json.RawMessage `json:"canonicalIdentity,omitempty"`
+ Policy json.RawMessage `json:"policy,omitempty"`
+ AISafeSummary string `json:"aiSafeSummary,omitempty"`
+ Capabilities json.RawMessage `json:"capabilities,omitempty"`
+ Relationships json.RawMessage `json:"relationships,omitempty"`
+ RecentChanges json.RawMessage `json:"recentChanges,omitempty"`
+ FacetCounts json.RawMessage `json:"facetCounts,omitempty"`
+ Incidents json.RawMessage `json:"incidents,omitempty"`
+ Proxmox json.RawMessage `json:"proxmox,omitempty"`
+ Storage json.RawMessage `json:"storage,omitempty"`
+ Agent json.RawMessage `json:"agent,omitempty"`
+ Docker json.RawMessage `json:"docker,omitempty"`
+ PBS json.RawMessage `json:"pbs,omitempty"`
+ PMG json.RawMessage `json:"pmg,omitempty"`
+ Kubernetes json.RawMessage `json:"kubernetes,omitempty"`
+ PhysicalDisk json.RawMessage `json:"physicalDisk,omitempty"`
+ Ceph json.RawMessage `json:"ceph,omitempty"`
+ TrueNAS json.RawMessage `json:"truenas,omitempty"`
+ VMware json.RawMessage `json:"vmware,omitempty"`
+ Availability json.RawMessage `json:"availability,omitempty"`
+
// Platform-specific data (JSON blob)
PlatformData json.RawMessage `json:"platformData,omitempty"`
}
diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.go
index c366c56c11..8800955d44 100644
--- a/internal/monitoring/canonical_guardrails_test.go
+++ b/internal/monitoring/canonical_guardrails_test.go
@@ -146,6 +146,31 @@ func TestStateBroadcastTreatsTypedNilHubAsAbsent(t *testing.T) {
}
}
+func TestBroadcastResourceProjectionPreservesCanonicalHealthContext(t *testing.T) {
+ data, err := os.ReadFile("monitor.go")
+ if err != nil {
+ t.Fatalf("failed to read monitor.go: %v", err)
+ }
+ source := string(data)
+
+ for _, snippet := range []string{
+ "if resource.DiscoveryTarget == nil {",
+ "if resource.MetricsTarget == nil {",
+ "unifiedresources.RefreshCanonicalMetadata(&resource)",
+ "IncidentSummary: resource.IncidentSummary",
+ "Canonical: monitorRawJSON(resource.Canonical)",
+ "DiscoveryTarget: monitorRawJSON(resource.DiscoveryTarget)",
+ "MetricsTarget: monitorRawJSON(resource.MetricsTarget)",
+ "Storage: monitorRawJSON(resource.Storage)",
+ "Agent: monitorRawJSON(resource.Agent)",
+ "Incidents: monitorRawJSON(resource.Incidents)",
+ } {
+ if !strings.Contains(source, snippet) {
+ t.Fatalf("monitor.go must contain %q", snippet)
+ }
+ }
+}
+
func TestMetricsStoreRuntimeOverridesStayOnMonitorBoundary(t *testing.T) {
data, err := os.ReadFile("monitor.go")
if err != nil {
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index efea9c2897..dcb0e83998 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -4890,32 +4890,71 @@ func convertResourcesForBroadcast(allResources []unifiedresources.Resource) []mo
}
func monitorResourceToConvertInput(resource unifiedresources.Resource) models.ResourceConvertInput {
- unifiedresources.RefreshCanonicalMetadata(&resource)
resourceType := monitorFrontendResourceType(resource)
+ if resource.DiscoveryTarget == nil {
+ resource.DiscoveryTarget = monitorDiscoveryTarget(resource, resourceType)
+ }
+ if resource.MetricsTarget == nil {
+ resource.MetricsTarget = monitorMetricsTarget(resource, resourceType)
+ }
+ unifiedresources.RefreshCanonicalMetadata(&resource)
name, displayName := monitorFrontendNames(resource, resourceType)
platformID := monitorPlatformID(resource, resourceType)
input := models.ResourceConvertInput{
- ID: resource.ID,
- Type: resourceType,
- Name: name,
- DisplayName: displayName,
- PlatformID: platformID,
- PlatformType: monitorPlatformType(resource, resourceType),
- SourceType: monitorSourceType(resource.Sources),
- ParentID: monitorStringValue(resource.ParentID),
- ClusterID: monitorClusterID(resource),
- Status: monitorFrontendStatus(resource, resourceType),
- CPU: monitorMetricInput(monitorMetricValue(resource.Metrics, func(metrics *unifiedresources.ResourceMetrics) *unifiedresources.MetricValue { return metrics.CPU })),
- Memory: monitorMetricInput(monitorMetricValue(resource.Metrics, func(metrics *unifiedresources.ResourceMetrics) *unifiedresources.MetricValue { return metrics.Memory })),
- Disk: monitorMetricInput(monitorMetricValue(resource.Metrics, func(metrics *unifiedresources.ResourceMetrics) *unifiedresources.MetricValue { return metrics.Disk })),
- Temperature: monitorTemperature(resource),
- Uptime: monitorUptime(resource),
- Tags: append([]string(nil), resource.Tags...),
- Labels: monitorLabels(resource),
- LastSeenUnix: monitorLastSeenUnix(resource.LastSeen),
- Identity: monitorIdentity(resource, name),
- PlatformData: monitorPlatformData(resource, resourceType, platformID),
+ ID: resource.ID,
+ Type: resourceType,
+ Technology: resource.Technology,
+ Name: name,
+ DisplayName: displayName,
+ PlatformID: platformID,
+ PlatformType: monitorPlatformType(resource, resourceType),
+ SourceType: monitorSourceType(resource.Sources),
+ ParentID: monitorStringValue(resource.ParentID),
+ ClusterID: monitorClusterID(resource),
+ Status: monitorFrontendStatus(resource, resourceType),
+ CPU: monitorMetricInput(monitorMetricValue(resource.Metrics, func(metrics *unifiedresources.ResourceMetrics) *unifiedresources.MetricValue { return metrics.CPU })),
+ Memory: monitorMetricInput(monitorMetricValue(resource.Metrics, func(metrics *unifiedresources.ResourceMetrics) *unifiedresources.MetricValue { return metrics.Memory })),
+ Disk: monitorMetricInput(monitorMetricValue(resource.Metrics, func(metrics *unifiedresources.ResourceMetrics) *unifiedresources.MetricValue { return metrics.Disk })),
+ Temperature: monitorTemperature(resource),
+ Uptime: monitorUptime(resource),
+ Tags: append([]string(nil), resource.Tags...),
+ Labels: monitorLabels(resource),
+ LastSeenUnix: monitorLastSeenUnix(resource.LastSeen),
+ IncidentCount: resource.IncidentCount,
+ IncidentCode: resource.IncidentCode,
+ IncidentSeverity: string(resource.IncidentSeverity),
+ IncidentSummary: resource.IncidentSummary,
+ IncidentCategory: resource.IncidentCategory,
+ IncidentLabel: resource.IncidentLabel,
+ IncidentPriority: resource.IncidentPriority,
+ IncidentImpactSummary: resource.IncidentImpactSummary,
+ IncidentUrgency: resource.IncidentUrgency,
+ IncidentAction: resource.IncidentAction,
+ Identity: monitorIdentity(resource, name),
+ DiscoveryTarget: monitorRawJSON(resource.DiscoveryTarget),
+ MetricsTarget: monitorRawJSON(resource.MetricsTarget),
+ Canonical: monitorRawJSON(resource.Canonical),
+ Policy: monitorRawJSON(resource.Policy),
+ AISafeSummary: resource.AISafeSummary,
+ Capabilities: monitorRawJSON(resource.Capabilities),
+ Relationships: monitorRawJSON(resource.Relationships),
+ RecentChanges: monitorRawJSON(resource.RecentChanges),
+ FacetCounts: monitorRawJSON(resource.FacetCounts),
+ Incidents: monitorRawJSON(resource.Incidents),
+ Proxmox: monitorRawJSON(resource.Proxmox),
+ Storage: monitorRawJSON(resource.Storage),
+ Agent: monitorRawJSON(resource.Agent),
+ Docker: monitorRawJSON(resource.Docker),
+ PBS: monitorRawJSON(resource.PBS),
+ PMG: monitorRawJSON(resource.PMG),
+ Kubernetes: monitorRawJSON(resource.Kubernetes),
+ PhysicalDisk: monitorRawJSON(resource.PhysicalDisk),
+ Ceph: monitorRawJSON(resource.Ceph),
+ TrueNAS: monitorRawJSON(resource.TrueNAS),
+ VMware: monitorRawJSON(resource.VMware),
+ Availability: monitorRawJSON(resource.Availability),
+ PlatformData: monitorPlatformData(resource, resourceType, platformID),
}
hasNetwork, rx, tx := monitorNetworkMetricInput(resource.Metrics)
@@ -4926,6 +4965,97 @@ func monitorResourceToConvertInput(resource unifiedresources.Resource) models.Re
return input
}
+func monitorRawJSON(value interface{}) json.RawMessage {
+ if value == nil {
+ return nil
+ }
+ encoded, err := json.Marshal(value)
+ if err != nil || string(encoded) == "null" {
+ return nil
+ }
+ return encoded
+}
+
+func monitorDiscoveryTarget(resource unifiedresources.Resource, resourceType string) *unifiedresources.DiscoveryTarget {
+ switch resourceType {
+ case "agent", "docker-host":
+ agentID := monitorAgentTargetID(resource)
+ if agentID == "" {
+ return nil
+ }
+ return &unifiedresources.DiscoveryTarget{
+ ResourceType: string(unifiedresources.ResourceTypeAgent),
+ AgentID: agentID,
+ ResourceID: agentID,
+ Hostname: monitorTargetHostname(resource),
+ }
+ default:
+ return nil
+ }
+}
+
+func monitorMetricsTarget(resource unifiedresources.Resource, resourceType string) *unifiedresources.MetricsTarget {
+ switch resourceType {
+ case "agent", "docker-host":
+ agentID := monitorAgentTargetID(resource)
+ if agentID == "" {
+ return nil
+ }
+ return &unifiedresources.MetricsTarget{
+ ResourceType: string(unifiedresources.ResourceTypeAgent),
+ ResourceID: agentID,
+ }
+ default:
+ return nil
+ }
+}
+
+func monitorAgentTargetID(resource unifiedresources.Resource) string {
+ if resource.Agent != nil {
+ if id := strings.TrimSpace(resource.Agent.AgentID); id != "" {
+ return id
+ }
+ }
+ if resource.Docker != nil {
+ if id := strings.TrimSpace(resource.Docker.AgentID); id != "" {
+ return id
+ }
+ if id := strings.TrimSpace(resource.Docker.HostSourceID); id != "" {
+ return id
+ }
+ }
+ if resource.Kubernetes != nil {
+ if id := strings.TrimSpace(resource.Kubernetes.AgentID); id != "" {
+ return id
+ }
+ }
+ return ""
+}
+
+func monitorTargetHostname(resource unifiedresources.Resource) string {
+ if resource.Agent != nil {
+ if hostname := strings.TrimSpace(resource.Agent.Hostname); hostname != "" {
+ return hostname
+ }
+ }
+ if resource.Docker != nil {
+ if hostname := strings.TrimSpace(resource.Docker.Hostname); hostname != "" {
+ return hostname
+ }
+ }
+ if resource.PBS != nil {
+ if hostname := strings.TrimSpace(resource.PBS.Hostname); hostname != "" {
+ return hostname
+ }
+ }
+ if resource.PMG != nil {
+ if hostname := strings.TrimSpace(resource.PMG.Hostname); hostname != "" {
+ return hostname
+ }
+ }
+ return strings.TrimSpace(resource.Name)
+}
+
func monitorFrontendResourceType(resource unifiedresources.Resource) string {
return string(unifiedresources.ContractResourceType(resource))
}
diff --git a/internal/monitoring/monitor_agents.go b/internal/monitoring/monitor_agents.go
index 092e2bc73a..ea23cf8dd7 100644
--- a/internal/monitoring/monitor_agents.go
+++ b/internal/monitoring/monitor_agents.go
@@ -1795,6 +1795,9 @@ func (m *Monitor) ApplyHostReport(report agentshost.Report, tokenRecord *config.
if status == "" {
status = normalizeLegacyUnraidDiskStatus(rawStatus, device)
}
+ if isLegacyUnraidEmptySlot(disk, status) {
+ continue
+ }
disks = append(disks, models.HostUnraidDisk{
Name: strings.TrimSpace(disk.Name),
Device: device,
@@ -2143,6 +2146,23 @@ func normalizeLegacyUnraidDiskStatus(rawStatus, device string) string {
}
}
+func isLegacyUnraidEmptySlot(disk agentshost.UnraidDisk, normalizedStatus string) bool {
+ rawStatus := strings.ToUpper(strings.TrimSpace(disk.RawStatus))
+ status := strings.ToLower(strings.TrimSpace(normalizedStatus))
+ if !strings.Contains(rawStatus, "DISK_NP") && status != "missing" {
+ return false
+ }
+ name := strings.ToLower(strings.TrimSpace(disk.Name))
+ role := strings.ToLower(strings.TrimSpace(disk.Role))
+ if name != "" && role != "parity" && !strings.HasPrefix(name, "parity") {
+ return false
+ }
+ return strings.TrimSpace(disk.Device) == "" &&
+ strings.TrimSpace(disk.Serial) == "" &&
+ strings.TrimSpace(disk.Filesystem) == "" &&
+ disk.SizeBytes == 0
+}
+
func hostDiskIOMetricResourceID(host models.Host, io models.DiskIO) string {
device := normalizeHostDiskDevice(io.Device)
if device == "" {
diff --git a/internal/monitoring/monitor_host_agents_test.go b/internal/monitoring/monitor_host_agents_test.go
index f724b618e6..2c5d9e2bd7 100644
--- a/internal/monitoring/monitor_host_agents_test.go
+++ b/internal/monitoring/monitor_host_agents_test.go
@@ -855,6 +855,62 @@ func TestApplyHostReportNormalizesLegacyUnraidRawStatuses(t *testing.T) {
}
}
+func TestApplyHostReportFiltersLegacyUnraidEmptySlots(t *testing.T) {
+ t.Helper()
+
+ monitor := &Monitor{
+ state: models.NewState(),
+ alertManager: alerts.NewManager(),
+ hostTokenBindings: make(map[string]string),
+ config: &config.Config{},
+ rateTracker: NewRateTracker(),
+ }
+ t.Cleanup(func() { monitor.alertManager.Stop() })
+
+ report := agentshost.Report{
+ Agent: agentshost.AgentInfo{
+ ID: "agent-tower-empty-slots",
+ Version: "5.1.27",
+ IntervalSeconds: 30,
+ },
+ Host: agentshost.HostInfo{
+ ID: "machine-tower-empty-slots",
+ Hostname: "tower",
+ MachineID: "machine-tower-empty-slots",
+ },
+ Metrics: agentshost.Metrics{
+ Memory: agentshost.MemoryMetric{TotalBytes: 1024, UsedBytes: 512, FreeBytes: 512, Usage: 50},
+ },
+ Unraid: &agentshost.UnraidStorage{
+ ArrayStarted: true,
+ ArrayState: "STARTED",
+ NumDisabled: 2,
+ NumInvalid: 2,
+ Disks: []agentshost.UnraidDisk{
+ {Name: "parity", Role: "parity", RawStatus: "DISK_NP_DSBL"},
+ {Name: "md1p1", Device: "/dev/sde", RawStatus: "DISK_OK", SizeBytes: 5860522532},
+ {RawStatus: "DISK_NP", Slot: 5},
+ {RawStatus: "DISK_NP_DSBL", Slot: 29},
+ },
+ },
+ Timestamp: time.Now().UTC(),
+ }
+
+ host, err := monitor.ApplyHostReport(report, nil)
+ if err != nil {
+ t.Fatalf("ApplyHostReport: %v", err)
+ }
+ if host.Unraid == nil {
+ t.Fatal("expected unraid topology on host")
+ }
+ if len(host.Unraid.Disks) != 1 {
+ t.Fatalf("unraid disk count = %d, want only assigned disks: %+v", len(host.Unraid.Disks), host.Unraid.Disks)
+ }
+ if got := host.Unraid.Disks[0]; got.Device != "/dev/sde" || got.Status != "online" {
+ t.Fatalf("unexpected assigned disk: %+v", got)
+ }
+}
+
func TestApplyHostReportFiltersVendorManagedSystemRAIDArrays(t *testing.T) {
t.Helper()
diff --git a/internal/monitoring/monitor_unified_state_test.go b/internal/monitoring/monitor_unified_state_test.go
index 55d1d56ebd..be014e9848 100644
--- a/internal/monitoring/monitor_unified_state_test.go
+++ b/internal/monitoring/monitor_unified_state_test.go
@@ -1,6 +1,7 @@
package monitoring
import (
+ "encoding/json"
"testing"
"time"
@@ -8,6 +9,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/mock"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
+ "github.com/rcourtman/pulse-go-rewrite/internal/storagehealth"
"github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"
)
@@ -347,6 +349,160 @@ func TestMonitorBuildBroadcastFrontendStateUsesCanonicalMockUnifiedResources(t *
}
}
+func TestConvertResourcesForBroadcastIncludesCanonicalHealthContext(t *testing.T) {
+ resources := []unifiedresources.Resource{
+ {
+ ID: "agent:tower",
+ Type: unifiedresources.ResourceTypeAgent,
+ Name: "Tower",
+ Status: unifiedresources.StatusWarning,
+ LastSeen: time.Date(2026, 5, 8, 11, 30, 0, 0, time.UTC),
+ Sources: []unifiedresources.DataSource{unifiedresources.SourceAgent},
+ IncidentCount: 1,
+ IncidentSeverity: storagehealth.RiskWarning,
+ IncidentSummary: "Unraid array is running without parity protection",
+ Agent: &unifiedresources.AgentData{
+ AgentID: "agent-1",
+ Hostname: "tower",
+ OSName: "Unraid",
+ StoragePostureSummary: "Unraid array is running without parity protection",
+ StorageRisk: &unifiedresources.StorageRisk{
+ Level: storagehealth.RiskWarning,
+ Reasons: []unifiedresources.StorageRiskReason{{
+ Code: "unraid_no_parity",
+ Severity: storagehealth.RiskWarning,
+ Summary: "Unraid array is running without parity protection",
+ }},
+ },
+ Unraid: &unifiedresources.HostUnraidMeta{
+ ArrayStarted: true,
+ ArrayState: "STARTED",
+ PostureSummary: "Unraid array is running without parity protection",
+ Risk: &unifiedresources.StorageRisk{
+ Level: storagehealth.RiskWarning,
+ Reasons: []unifiedresources.StorageRiskReason{{
+ Code: "unraid_no_parity",
+ Severity: storagehealth.RiskWarning,
+ Summary: "Unraid array is running without parity protection",
+ }},
+ },
+ },
+ },
+ Docker: &unifiedresources.DockerData{
+ AgentID: "agent-1",
+ HostSourceID: "agent-1",
+ Hostname: "tower",
+ Runtime: "docker",
+ },
+ },
+ {
+ ID: "agent:tower/storage:unraid-array",
+ Type: unifiedresources.ResourceTypeStorage,
+ Name: "Tower Array",
+ Status: unifiedresources.StatusWarning,
+ LastSeen: time.Date(2026, 5, 8, 11, 30, 0, 0, time.UTC),
+ Sources: []unifiedresources.DataSource{unifiedresources.SourceAgent},
+ Storage: &unifiedresources.StorageMeta{
+ Platform: "unraid",
+ RiskSummary: "Unraid array is running without parity protection",
+ PostureSummary: "Unraid array is running without parity protection",
+ Risk: &unifiedresources.StorageRisk{
+ Level: storagehealth.RiskWarning,
+ Reasons: []unifiedresources.StorageRiskReason{{
+ Code: "unraid_no_parity",
+ Severity: storagehealth.RiskWarning,
+ Summary: "Unraid array is running without parity protection",
+ }},
+ },
+ },
+ },
+ }
+
+ frontend := convertResourcesForBroadcast(resources)
+ if len(frontend) != 2 {
+ t.Fatalf("expected 2 frontend resources, got %d", len(frontend))
+ }
+
+ var agentPayload struct {
+ IncidentSummary string `json:"incidentSummary"`
+ Canonical struct {
+ PrimaryID string `json:"primaryId"`
+ } `json:"canonicalIdentity"`
+ DiscoveryTarget struct {
+ ResourceType string `json:"resourceType"`
+ AgentID string `json:"agentId"`
+ } `json:"discoveryTarget"`
+ MetricsTarget struct {
+ ResourceType string `json:"resourceType"`
+ ResourceID string `json:"resourceId"`
+ } `json:"metricsTarget"`
+ Agent struct {
+ StoragePostureSummary string `json:"storagePostureSummary"`
+ Unraid struct {
+ PostureSummary string `json:"postureSummary"`
+ Risk struct {
+ Reasons []struct {
+ Code string `json:"code"`
+ Summary string `json:"summary"`
+ } `json:"reasons"`
+ } `json:"risk"`
+ } `json:"unraid"`
+ } `json:"agent"`
+ }
+ encoded, err := json.Marshal(frontend[0])
+ if err != nil {
+ t.Fatalf("marshal agent frontend resource: %v", err)
+ }
+ if err := json.Unmarshal(encoded, &agentPayload); err != nil {
+ t.Fatalf("unmarshal agent frontend resource: %v", err)
+ }
+ if agentPayload.IncidentSummary != "Unraid array is running without parity protection" {
+ t.Fatalf("incident summary = %q", agentPayload.IncidentSummary)
+ }
+ if agentPayload.Canonical.PrimaryID != "agent:agent-1" {
+ t.Fatalf("canonical primary ID = %q", agentPayload.Canonical.PrimaryID)
+ }
+ if agentPayload.DiscoveryTarget.ResourceType != "agent" || agentPayload.DiscoveryTarget.AgentID != "agent-1" {
+ t.Fatalf("discovery target = %+v", agentPayload.DiscoveryTarget)
+ }
+ if agentPayload.MetricsTarget.ResourceType != "agent" || agentPayload.MetricsTarget.ResourceID != "agent-1" {
+ t.Fatalf("metrics target = %+v", agentPayload.MetricsTarget)
+ }
+ if agentPayload.Agent.StoragePostureSummary != "Unraid array is running without parity protection" {
+ t.Fatalf("agent storage posture summary = %q", agentPayload.Agent.StoragePostureSummary)
+ }
+ if agentPayload.Agent.Unraid.PostureSummary != "Unraid array is running without parity protection" {
+ t.Fatalf("unraid posture summary = %q", agentPayload.Agent.Unraid.PostureSummary)
+ }
+ if len(agentPayload.Agent.Unraid.Risk.Reasons) != 1 || agentPayload.Agent.Unraid.Risk.Reasons[0].Code != "unraid_no_parity" {
+ t.Fatalf("unraid risk reasons = %#v", agentPayload.Agent.Unraid.Risk.Reasons)
+ }
+
+ var storagePayload struct {
+ Storage struct {
+ PostureSummary string `json:"postureSummary"`
+ Risk struct {
+ Reasons []struct {
+ Code string `json:"code"`
+ } `json:"reasons"`
+ } `json:"risk"`
+ } `json:"storage"`
+ }
+ encoded, err = json.Marshal(frontend[1])
+ if err != nil {
+ t.Fatalf("marshal storage frontend resource: %v", err)
+ }
+ if err := json.Unmarshal(encoded, &storagePayload); err != nil {
+ t.Fatalf("unmarshal storage frontend resource: %v", err)
+ }
+ if storagePayload.Storage.PostureSummary != "Unraid array is running without parity protection" {
+ t.Fatalf("storage posture summary = %q", storagePayload.Storage.PostureSummary)
+ }
+ if len(storagePayload.Storage.Risk.Reasons) != 1 || storagePayload.Storage.Risk.Reasons[0].Code != "unraid_no_parity" {
+ t.Fatalf("storage risk reasons = %#v", storagePayload.Storage.Risk.Reasons)
+ }
+}
+
func TestMonitorMonitoredSystemUsageWaitsForSupplementalReadinessAndStoreFreshness(t *testing.T) {
monitor := &Monitor{}
monitor.SetResourceStore(unifiedresources.NewMonitorAdapter(nil))
diff --git a/internal/storagehealth/topology.go b/internal/storagehealth/topology.go
index 58d0a4c561..eb4410ef03 100644
--- a/internal/storagehealth/topology.go
+++ b/internal/storagehealth/topology.go
@@ -203,6 +203,9 @@ func AssessUnraidStorage(storage models.HostUnraidStorage) Assessment {
parityConfigured := false
parityHealthy := false
for _, disk := range storage.Disks {
+ if isUnraidEmptySlot(disk) {
+ continue
+ }
role := strings.ToLower(strings.TrimSpace(disk.Role))
status := strings.ToLower(strings.TrimSpace(disk.Status))
if role != "parity" {
@@ -240,6 +243,9 @@ func AssessUnraidStorage(storage models.HostUnraidStorage) Assessment {
func unraidDiskStateCounts(storage models.HostUnraidStorage) (disabled, invalid, missing int) {
hasStructuredStatus := false
for _, disk := range storage.Disks {
+ if isUnraidEmptySlot(disk) {
+ continue
+ }
status := strings.ToLower(strings.TrimSpace(disk.Status))
if status == "" {
continue
@@ -260,6 +266,23 @@ func unraidDiskStateCounts(storage models.HostUnraidStorage) (disabled, invalid,
return storage.NumDisabled, storage.NumInvalid, storage.NumMissing
}
+func isUnraidEmptySlot(disk models.HostUnraidDisk) bool {
+ rawStatus := strings.ToUpper(strings.TrimSpace(disk.RawStatus))
+ status := strings.ToLower(strings.TrimSpace(disk.Status))
+ if !strings.Contains(rawStatus, "DISK_NP") && status != "missing" {
+ return false
+ }
+ name := strings.ToLower(strings.TrimSpace(disk.Name))
+ role := strings.ToLower(strings.TrimSpace(disk.Role))
+ if name != "" && role != "parity" && !strings.HasPrefix(name, "parity") {
+ return false
+ }
+ return strings.TrimSpace(disk.Device) == "" &&
+ strings.TrimSpace(disk.Serial) == "" &&
+ strings.TrimSpace(disk.Filesystem) == "" &&
+ disk.SizeBytes == 0
+}
+
func AssessPBSDatastore(datastore models.PBSDatastore) Assessment {
assessment := Assessment{Level: RiskHealthy}
addReason := func(code string, severity RiskLevel, summary string) {
diff --git a/internal/storagehealth/topology_test.go b/internal/storagehealth/topology_test.go
index cff55cd34e..277cf84daa 100644
--- a/internal/storagehealth/topology_test.go
+++ b/internal/storagehealth/topology_test.go
@@ -227,6 +227,37 @@ func TestAssessUnraidStorageSyncInProgress(t *testing.T) {
}
}
+func TestAssessUnraidStorageTreatsEmptyNoPresentSlotsAsUnprotected(t *testing.T) {
+ assessment := AssessUnraidStorage(models.HostUnraidStorage{
+ ArrayStarted: true,
+ NumDisabled: 2,
+ NumInvalid: 2,
+ NumMissing: 0,
+ Disks: []models.HostUnraidDisk{
+ {Name: "parity", Role: "parity", Status: "missing", RawStatus: "DISK_NP_DSBL"},
+ {Name: "md1p1", Device: "/dev/sde", Status: "online", RawStatus: "DISK_OK", SizeBytes: 5860522532},
+ {Status: "missing", RawStatus: "DISK_NP", Slot: 5},
+ {Status: "missing", RawStatus: "DISK_NP_DSBL", Slot: 29},
+ },
+ })
+
+ if assessment.Level != RiskWarning {
+ t.Fatalf("Level = %q, want %q; reasons %+v", assessment.Level, RiskWarning, assessment.Reasons)
+ }
+ foundNoParity := false
+ for _, reason := range assessment.Reasons {
+ switch reason.Code {
+ case "unraid_no_parity":
+ foundNoParity = true
+ case "unraid_missing_disks", "unraid_parity_unavailable", "unraid_disabled_disks", "unraid_invalid_disks":
+ t.Fatalf("unexpected failure reason for empty no-present slots: %+v", assessment.Reasons)
+ }
+ }
+ if !foundNoParity {
+ t.Fatalf("expected no-parity reason, got %+v", assessment.Reasons)
+ }
+}
+
func TestAssessUnraidStorageUsesDiskStatusesOverAggregateCounters(t *testing.T) {
assessment := AssessUnraidStorage(models.HostUnraidStorage{
ArrayStarted: true,