Files
pulse/internal
rcourtman 9aaac4d3e5 Read a linked agent's own heartbeat in host snapshots (#2601)
A host agent linked to a Proxmox node merges into one unified host row.
When the agent stops reporting but PVE polling continues, that row stays
online and its `LastSeen` follows the PVE sighting.
`hostFromReadStateView` copied both into `models.Host`, so a silent
agent looked current to every consumer of the projection:

- `linkedHostForNode` accepted it, and `resolveNodeDisk` kept using the
agent's last filesystem summary as the node's disk, feeding disk alerts
and history with a frozen reading. Its retained ZFS datasets kept
merging into the node's pools.
- Agent connections built from `HostsSnapshot()` (the Connections list
and the update-readiness agent check) aged the agent from the PVE poll,
so a dead agent stayed Active.

The projection now takes `LastSeen` from the agent source's own sighting
(`HostView.SourceStatus(SourceAgent)`, added in #2582) and reports the
agent offline once that sighting is past its reporting lease
(`hostAgentReportCurrent`, the same `hostAgentHealthWindow` that
`evaluateHostAgents` applies). Rows without an agent sighting, such as
vSphere and TrueNAS hosts, keep the row's values.

Verification:
- New `TestSilentLinkedAgentStopsFeedingNodeDisk` (registry-backed
merged agent + node row, driven through `evaluateHostAgents` and the
store refresh): node disk uses the agent summary while it reports, falls
back to the Proxmox rootfs past the lease, and returns when the agent
reports again; the projected agent reads offline with its own last
report. It fails against the previous `monitor.go` (checked with `go
test -overlay`).
- `go test ./internal/monitoring/` and the connections, readiness,
update and agent-lifecycle tests in `./internal/api/` pass.
2026-10-06 20:02:09 +01:00
..