mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-21 18:53:37 +00:00
113190a920
CleanupAlertsForNodes removes alerts whose Node isn't in existingNodes. That map is built upstream only from state.Nodes (Proxmox nodes) and state.PBSInstances (PBS instances) — no agent resources. Agent-sourced alerts (Unraid, standalone Linux hosts, TrueNAS, anything reached via Pulse Agent) typically have Node="" or an agent UUID, so they fall into the cleanup branch every cycle. Then the next poll re-creates the alert as new, calls AddAlert, and appends a fresh history row. Observed in the wild: 3,980 alert history entries in 7 days, with the same canonical alert ID (e.g. "Unraid array running without parity protection") appearing every 30 seconds. Adds a carve-out for ResourceID prefixes starting with "agent:", matching the existing pattern for "docker-" / "docker:" and "pbs-" / "pbs-offline". Locks in the behaviour with a new subtest that mixes agent-sourced and Proxmox-sourced alerts and asserts that only the legitimately stale Proxmox alert is removed.