refactor: split host alert checker

Move host-agent identity, metric projection, disk/SMART/RAID/Unraid health handling, cleanup, and offline lifecycle into internal/alerts/host.go.

Keep shared health-assessment evaluation package-level for now because storage ZFS and host SMART/RAID still share that bridge, while recording host.go as the host checker owner in the alerts subsystem contract.

Proof: go test ./internal/alerts/...
This commit is contained in:
rcourtman 2026-05-06 13:50:13 +01:00
parent 3d8cb6c8a5
commit 8a21162f35
4 changed files with 1049 additions and 1017 deletions

View file

@ -61,6 +61,7 @@ operator-facing alert routing behavior for live runtime alerts.
39. `internal/alerts/pbs.go`
40. `internal/alerts/storage.go`
41. `internal/alerts/node.go`
42. `internal/alerts/host.go`
## Shared Boundaries
@ -253,6 +254,12 @@ owns node metric and temperature projection, node offline lifecycle handling,
host-agent deduplication bookkeeping, and instance-scoped node display-name
cache updates; future Proxmox node alert behavior should extend that resource
checker owner rather than expanding the central Manager file.
Host-agent alert evaluation now lives in `internal/alerts/host.go`. That file
owns host identity, host-agent metric projection, host disk/SMART/RAID/Unraid
health handling, host cleanup, and host offline lifecycle handling; future host
agent alert behavior should extend that resource checker owner while shared
health-assessment evaluation remains package-level until all storage-health
callers can be separated behind a narrower owner.
Commercial alert handoffs now follow the same shared navigation boundary.
`frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx` may resolve
the canonical `ai_alerts` destination from the shared license/commercial

File diff suppressed because it is too large Load diff

View file

@ -316,6 +316,15 @@ func TestNodeDisplayNameCacheKeyTrimsParts(t *testing.T) {
}
}
func TestHostResourceIDTrimsID(t *testing.T) {
if got := hostResourceID(" host-1 "); got != "agent:host-1" {
t.Fatalf("hostResourceID() = %q, want %q", got, "agent:host-1")
}
if got := hostResourceID(" \t "); got != "agent:unknown" {
t.Fatalf("blank hostResourceID() = %q, want %q", got, "agent:unknown")
}
}
func TestQuietHoursCategoryForResourceIncidentUsesIncidentCategoryMetadata(t *testing.T) {
availability := &Alert{
Type: "resource-incident",

1033
internal/alerts/host.go Normal file

File diff suppressed because it is too large Load diff