A PBS outage removed the datastore from a poll and stored the instance
without job results, so every failed-job alert cleared and fired again
when PBS returned. Job incidents now need two polls that see success
before recovering, so a missing datastore reads as unknown, and a failed
poll keeps the last job results so the carry survives the outage.
Only a failed job-list read now makes a family unreadable; task-history
trouble no longer keeps a removed job's failure alive. Recovery is judged
from the run's own status, so a success first seen after its next
schedule passed still clears the carry. Carried failures stay in memory:
a restart forgets them until PBS reports the job again.
A PBS sync that failed after a successful backup left everything green
and raised nothing (#1815). A failed sync, verify, prune or GC run is a
problem with the datastore, not the guest, so each PBS datastore now
carries a pbs_job_failed incident per job whose newest run failed. The
existing incident pipeline turns it into a warning alert on that
datastore. Backup health lists the same failures under a Datastore jobs
heading, and guest counts are unchanged.
The poller now carries a job's last completed failure through polls
that report no newer outcome (a run in progress, an overdue job, a
failed read), so the alert neither flaps nor clears early. Jobs are
keyed by family as well as id, and a failed last run outranks overdue.
Mock PBS servers report job results, with one failed sync.
The battery sensor in #3565 (applesmc TB0T) needs an alert without a
custom-metrics script. The agent now reports every lm-sensors input
with a stable key, so a threshold can name one sensor.
A native temperature sensor raises an alert only when its own override
sets one: Overrides["agent:<host>/sensor:<hex>"].Temperature, where
<hex> is the lower-case hex of the sensor ID, so IDs that differ only
by case stay apart after host child IDs are lower-cased. There is no
default and nothing is inherited from the host's or a linked node's CPU
temperature. Evaluation uses the canonical metric path (metric
temperature, resource type agent-sensor, now a spec bridge type), so
delays, escalation, quiet hours and notifications behave as for other
temperatures.
The report carries no completeness state yet, so an invalid reading, a
missing sensor, an empty inventory or telemetry expiry hold a firing
alert instead of resolving it; the existing 24-hour stale sweep still
applies. Removing or disabling the override, host or agent alerting
off, host removal and a confirmed offline host resolve it. Config saves
re-judge it by its own threshold and drop pending runs whose policy the
save switched off, using the host link identity recorded with the run.
Alert history joins the machine, and Patrol never auto-resolves these
alerts because its snapshot holds no sensor reading.
No UI writes these overrides yet; the Thresholds section follows.
Refs #3565
The pre-snapshot upgrade test inserted an event fixed at 1 August 2026. It reached the normal 90-day retention cutoff on 30 October, so startup pruning could remove it before the migration assertion. Use a recent bound UTC timestamp and verify its legacy identity, type and time survive, retaining the empty-snapshot assertion. Production retention and schema behaviour are unchanged.
Contract-Neutral: Correct the time-dependent pre-snapshot migration fixture and strengthen preservation assertions; no production source, retention, schema or contract changes.
Change-source: pulse-maintainer
A PMG that answers its version read but fails one optional endpoint
(the queue read in #2960) was shown on Connections as Unreachable and
raised a critical connection-degraded alert. The poll error behind it
has category "partial" since the scheduler split: the connection
answered and only a downstream read failed.
deriveConnectionState now maps a partial error to a new "degraded"
connection state, ahead of the auth-text check, so a 403 from one
optional endpoint no longer marks the credential unauthorized. A partial
connection whose last success is past the stale cutoff is still stale.
Degraded rolls up as fleet adapter health "degraded", keeps credentials
verified and does not block rollout or workload inventory.
The connection-degraded alert treats degraded as a degraded
observation at warning severity. It still needs three observations to
fire, keeps an open outage open (a missing reading is not recovery),
and steps an open critical outage down to warning once the connection
answers again.
Connections shows an amber Degraded badge and an amber banner that
names the failed reading ("Queue status could not be read: Server
error ...") instead of a red, generic "Server error". The monitoring
category constant is exported so the ledger reads one value.
Alert messages name their own resource ("Docker service 'web' is
running 1 of 3 desired tasks"), which is right for a notification but
wasteful in an Alert History row whose Resource cell already names it.
At a 1280px window the one-line message track ran out inside the
repeated name, so the row showed "Docker service 'ops-postgres' i..."
and hid the condition itself.
Alerts now carry an optional Summary, the message without its subject
("Running 1 of 3 desired tasks", "Offline", "Powered off"). Builders set
it beside Message where they name their own resource: Docker services,
hosts and containers, nodes, PBS and PMG, guests, Pulse agents, storage,
connections and external probes. The canonical lifecycle evaluators copy
it into the alert they build, so it changes with the message, and clear
it when a MessageBuilder composes the message. The resolved read model,
the monitoring state sync and the mock fixture graph carry it to the
frontend.
History table rows lead with the summary and keep the full message as
their title. Cards, notifications and detail views keep the message, and
history recorded before this keeps showing its message. On the mock
estate at 1280px, 17 rows now read as their condition and none of them is
cut; cut messages fell from 54-62 of about 132 rows to 37.
Feed guest recovery to the shadow reducer even when no live alert exists, so interrupted grace and confirmation runs do not cause false shadow_divergence diagnostics for #3280. Preserve live alerting and genuine divergence reporting.
Contract-Neutral: Restore the existing live/shadow parity invariant only; no alert, intent, grace, notification, API or persisted-data contract changes.
Change-source: pulse-maintainer
Use the shared missing-observation path so failed PBS node-status polls
interrupt CPU and memory activation, intent grace and memory recovery clocks.
Preserve held incident evidence and independent connectivity policy. Cover
fresh timing boundaries, retained values, peer isolation and CPU recovery.
Contract-Neutral: Restore existing continuous-observation semantics for PBS CPU and memory; no threshold, delay, policy, identity, schema, route, connectivity or notification transport contract changes.
Change-source: pulse-maintainer
Keep static and forecast occurrences and timing honest when a storage percentage has missing or contradictory byte counters. Preserve empty-store recovery and let explicit usage disablement release an alert without requiring telemetry. Add real-manager controls and give existing positive-reading fixtures actual capacity.
Contract-Neutral: Refine admission to the existing capacity lifecycle; no new alert policy, API, schema, collector, transport or subsystem shape. The existing alerts contract and registered manager controls document and verify the boundary.
Change-source: pulse-maintainer
The unchanged two-percent/five-minute duplicate rule prevents an immediate repeat at 95 percent. Use a changed measured 98 percent to prove node evaluation resumes after agent removal. The earlier clock-only explanation was not causal; no production behavior changes.
Contract-Neutral: Correct the handover control's observation without changing alert thresholds, suppression policy or runtime contracts.
Change-source: pulse-maintainer
The broad race proof found a legacy disk fixture without capacity and a new handover control whose fixed observation clock predated the real release. Supply measured bytes and advance report time; do not change alert recovery or handover behavior.
Contract-Neutral: Correct node disk regression fixtures without changing runtime contracts or verification thresholds.
Change-source: pulse-maintainer
Reuse canonical disk observation admission before node alert evaluation. Missing capacity and contradictory readings preserve trusted occurrences and restart activation timing; measured zero, explicit policy and real linked-agent handover keep their semantics.
Contract-Neutral: Reuse existing disk observation and alert lifecycle contracts; no API, schema or ownership policy shape changes.
Change-source: pulse-maintainer
Retain the linked summary filesystem identity when its capacity becomes unavailable. Correct synthetic activation and authoritative-removal fixtures to exercise existing rules: disk recovery stays immediate, and an empty report does not establish removal. No delay, collector or policy change.
Contract-Neutral: Apply established identity and observation rules only; public API, canonical projection, thresholds and recovery policy are unchanged.
Change-source: pulse-maintainer
Collect only this host’s tracked filesystem identities. Exercise pending-node handover after the real configured grace, keep the original deadline, and check never-observed readings and authoritative replacement of pending filesystems.
Contract-Neutral: Host-local transient bookkeeping and test controls only; no public contract, metric admission, threshold or policy change.
Change-source: pulse-maintainer
Apply existing canonical disk observation admission to filesystem alert evaluation. Hold incidents across unavailable rows or empty reports, interrupt timed evidence and retain linked-node ownership only for held alerts. Keep measured-zero recovery, policy changes and authoritative removal.
Contract-Neutral: Shares existing disk metric admission and unavailable-observation rules without API, schema, collection or canonical projection changes.
Change-source: pulse-maintainer
Resolve the shared contract insertion by retaining both complete subsections. Preserve the reviewed snapshot creation-date repair and current main's independent backup success-date repair, tests and fixtures.
Contract-Neutral: Compose existing snapshot and backup warning preservation repairs without changing their public API, configuration, schema or canonical identity contracts. Retain both internal contract clarifications and executable verification.\nChange-source: pulse-maintainer
Change-source: pulse-maintainer
The focused source proof shows that global alerting disablement pauses evaluation without resolving existing incidents. Assert exact trusted occurrence preservation for that case; retain clearing assertions for snapshot/guest disablement, exclusions, threshold changes and removal. No production source changes.
Change-source: pulse-maintainer
Distinguish a listed snapshot with an unusable date from removal. Retain the last trusted canonical occurrence and evidence after current policy resolution, including Proxmox's missing-snaptime Unix epoch representation. Add lifecycle, exclusion, identity and real-consumer browser proof fixtures.
Contract-Neutral: Repair existing snapshot warning preservation on incomplete evidence; no API, configuration, schema or canonical identity change. Dedicated regression and browser-producer tests accompany the internal contract clarification.
Change-source: pulse-maintainer
A still-listed backup with a missing, zero or future success date is not recovery evidence. Keep its existing occurrence and prefer the newest usable date across provider rollups, without changing explicit exclusions or inventory removal.
Add manager regressions and a real Overview consumer fixture. Exact-source execution and browser/pixel verification remain pending the fresh launch required by the completed dependency acquisitions.
Change-source: pulse-maintainer
Most of the alert history fold was evidence nothing reads. On the
dogfood install a resolved snapshot averaged 21 KB, 83% of it the
evidence trail of up to 64 envelopes (35 on average), across 1,895
occurrences kept for 90 days (#1803). No Pulse UI, AI tool or API
handler reads Alert.evidence from history: the incident panel uses
the incident timeline, and the AI uses recently resolved alerts.
The fold now trims each decoded snapshot to its newest envelope, by
observedAt and then position (an updated envelope keeps its slot, so
the last one is not always the newest). History output applies the
same rule to live overlays and the JSON fallback, so every
/api/alerts/history entry carries at most one envelope.
operationalRecord.evidenceIds and transitions keep their full lists,
the event log keeps every snapshot whole, and /api/alerts/active still
returns an open alert's full evidence.
On a log shaped like the dogfood install's, the history fold went from
27.2 MB to 2.1 MB of retained heap. Negative controls: keeping full
evidence in the fold, in the output, or choosing the newest by position
each fail their test. The alerts tree passes on pulse-dev.
Related to #1803
On a long-running install the alert history projection was the largest
part of the Go heap: 36 of 78 MB live on the dogfood install, one merged
alert per occurrence for the event log's 90 days (#1803). Every read
then deep-copied the whole projection before applying its limit, so the
attention summary's 500-row read copied all 1,895 occurrences, and every
Since read (the 30-day alert-quality window, date-filtered history)
built a fresh projection and re-decoded every snapshot in its window.
Each occurrence now keeps one small mark per folded event (time, id and
the LastSeen it contributed) and the index of its latest acknowledged
snapshot. A Since window starts at the first event the log's own
occurred_at >= since text comparison admits, takes LastSeen and
acknowledgement from there and orders occurrences by their first
in-window event, so it equals a walk of only the window. Overlay, sort
and limit run on lightweight rows under the projection lock, and only
returned rows are copied, once, by canonicalizeAlertHistoryForOutput.
On a log shaped like the dogfood install's (about 1,900 occurrences,
40k events), a 30-day read went from 68.9 ms and 19.8 MB allocated to
5.2 ms and 2.8 MB, a 500-row read from 12.7 ms and 8.5 MB to 3.6 ms and
2.0 MB, and a full read from 20.8 ms and 12.9 MB to 13.4 ms and 6.9 MB.
A randomized test holds every window and limit equal to an independent
walk of only the window, across acknowledgements on both sides of the
boundary, uneven fractional seconds, same-instant events, a history
clear and live overlays. Negative controls: ignoring the window, a
fresh fold per Since read and copying every row each fail their test.
Related to #1803
Five stores set private page caches of 16 to 64 MB per connection.
The modernc driver allocates that cache with anonymous mmap outside
the Go heap, so GC and GOMEMLIMIT never see it, and each page costs
about twice its size. Measured: reading a 107 MB database through a
64 MB cache_size added 117 MB of resident memory, against 6 MB at
SQLite's 2 MB default. On a long-running dogfood install about 165 MB
of 360 MB resident sat outside the Go heap, with a 126 MB audit
database behind a 64 MB cache (#1803).
Audit, RBAC, notification queue, unified resources and the alert
event log (writer and both readers) now take pdb.PageCachePragma.
Pages that miss it come from the kernel file cache, which the kernel
can reclaim. The audit suite, including its large legacy migration,
takes the same time as before (309 s on both trees).
pkg/db tests reject any other cache_size in production code and bound
the resident growth of a 30 MB scan. Each store's test pins its
effective value. Negative controls: restoring the audit cache fails
the source scan, and a 64 MB reader cache grows a scan by 55 MB
against a 16 MB budget. modernc sorts _pragma values before applying
them, so a second cache_size in one DSN cannot reliably override.
Related to #1803
On v6.3.2 an image update that stayed asserted resolved and re-opened
about every 24 hours (#2353). The hourly sweep expired update tracking
by first detection, the next report restarted the delay below its
threshold without refreshing the open alert, and the stale-alert sweep
resolved it a day later, just before the restarted delay re-fired it.
Two later changes each close a path to that loop: tracking expiry now
follows the latest observation (f7a43d2794), and an open alert's start
stands in for tracking a restart lost (ed8415ea6a). Existing tests check
the tracking maps; this one drives several simulated days of reports and
hourly housekeeping and asserts at the alert itself: one opening, no
resolution, a stable start, while a current image or a removed container
still resolves. Reverting either change fails its own case.
The host-offline alert fires only when a Pulse agent's reports stop.
Pulse cannot tell a dead host from an agent that lost its route to
Pulse, yet the alert read "Host 'delly (Host Agent)' is offline" under
a "Host Offline" label. For a Proxmox node that keeps reporting through
its API, that sat a critical "offline" alert beside a green, live row.
Name what Pulse saw: "Pulse agent on 'delly' stopped reporting",
labelled "Agent Not Reporting". The alert type, identity and lifecycle
are unchanged, so acknowledgements, history and notification routing
carry over. Docker host offline alerts keep their own label.
A full or degraded pool's alert linked to the top of the Proxmox overview,
so the operator had to find the pool themselves. The alert card now links
Proxmox storage alerts to /proxmox/storage?resource=, and Storage opens and
reveals that pool.
ZFS pool and device alerts are raised under composite ids the resource
registry cannot open, so checkZFSPoolHealth stamps the owning storage as
storageResourceId metadata and the card prefers it. An unstamped composite
id opens Storage without naming a pool.
The Storage deep-link hook matched only Ceph pools by id or any name, so
alert source ids and shared names (every node has a local-zfs) missed or
opened the wrong pool. It now matches id, then metrics id, then a unique
name, resolves anything else through the registry, and opens every matched
pool. It acts only while Storage is the active Proxmox tab, because the
mounted-but-hidden Storage tab otherwise read guest links, and a pool the
operator opens or closes during a lookup outranks the link.
Three rules chose a node's single CPU temperature. Node history took
CPUMax first, agent history took cpu_package first, and the node drawer
recomputed the maximum of package, CPUMax and every core in the
browser. On an agent-fed node CPUMax is built from cores alone and can
sit below the package, and elsewhere a core can run above the package,
so the drawer's CPU temperature headline could disagree with the line
drawn beneath it and with the History tab. Node alerts and the CPU
low/record tracking used yet another package-first rule.
models.PrimaryCPUTemperatureCelsius is now the one rule: the hottest
usable package, CPU-maximum or core reading, with a sensor-map form for
agents. Node and agent history, the router's live fallbacks, the
unified resource temperature, node temperature alerts and the CPU
low/record tracking all call it. The drawer reads the resource value
through a new Node.cpuTemperature field instead of recomputing it, and
getCpuTemperature is removed.
Mock mode wrote a second package reading under a cpu.package key into
every agent host, including node-linked ones, from a series unrelated
to the node's static reading. A node and its linked agent now carry one
reading, sampled from the agent's series under the agent's real keys,
and both histories seed from that series, so the current reading
continues the line.
A guest's per-filesystem disk alert is raised under <guest>-disk-<key>,
which names nothing the resource registry can resolve, so the Alerts
overview left its name linking to the top of the platform page. A full
filesystem is the most common guest alert, and the operator still had to
find the guest among every other one.
CheckGuest now stamps the owning guest on every filesystem alert as
guestResourceId metadata: the same guest ID the guest's own alerts are
raised under, on the canonical-spec and legacy checkMetric paths alike.
The card links a filesystem alert to ?resource=<guestResourceId>, so the
workloads table opens that guest's drawer, where the Filesystems panel
shows the mount that filled. Filesystem alerts raised before this change
carry no stamp and keep the platform page link; the card never falls
back to the filesystem id.
Several Off toggles on the Thresholds page did nothing or did the
opposite, because each layer read 0, -1 and "missing" differently:
- PMG and Docker restart/memory-limit defaults: the toggle sends -1
and NormalizePMGDefaults/NormalizeDockerDefaults turned anything <= 0
back into the factory value, so Off reverted on save. The Docker
restart-loop and memory-limit checks also had no Off at all.
- Backup and snapshot critical age: the editor sanitizers and the save
payload raised a 0 critical to the warning age, so turning critical
off made backups go critical at the warning age.
- A Docker container override saved for CPU alone carried
DisableConnectivity=false and re-enabled that container's state
alerts over a disabled Docker default.
- Per-server PMG cells, PMG bulk edit and per-container restart and
memory-limit cells wrote fields ThresholdConfig does not have, so
the backend dropped them on save.
0 is now Off for these counts; negative values (the toggle's -1) are
stored as 0. Keys an older alerts.json or an import omits decode as
ThresholdCountUnset and take the factory value, so existing installs
keep their alerts; persistence resolves the marker before writing. A
PMG quarantine growth level with one half Off turns that level off
instead of invalidating the spec and skipping the whole check. Docker
container overrides re-enable state alerts only with their own
severity, as applyThresholdOverride does elsewhere. The frontend keeps
a 0 critical age Off, the group header says "Restart loop off", and
rows only offer metrics an override can store.
AI Patrol's threshold adapter still maps an Off alert threshold to its
factory value; that is a Patrol product decision and is left as is.
The new capacity regression passed after the production repair, but a snapshot assertion compared an incomplete synthetic identity with existing canonical backfill. Prepare that fixture consistently and also preserve untouched legacy fields in the multi-row no-op case. Retain the initial normal/race failures; no production semantics are changed.
Contract-Neutral: Synthetic history fixture correction and no-op assertion only; no runtime or public contract changes.
Change-source: pulse-maintainer
Count surviving rows before allocating expiry, deduplication and removal results. Keep unchanged history and preserve occurrence/evidence and primary, backup and retired-JSON recovery semantics. The parent retains original-sized arrays after sparse compaction; capacity and connected loader controls discriminate without forced GC or process profiles.
Contract-Neutral: Application alert-history backing storage only; retention windows, occurrence identity, ordering, evidence, persistence/recovery authority and public response shapes are unchanged.
Change-source: pulse-maintainer
TestMonitor_HandleAlertResolved_SuppressesRecoveryWhenFiringNeverDelivered
builds its alert manager with NewManager() under
PULSE_DATA_DIR=t.TempDir() and never stops it. Firing and resolving the
guest alert queues async active-alert checkpoints whose worker writes
<dir>/alerts, so a write can land while, or after, testing removes the
directory. This is the same race as the physical-disk temperature
fixture's cleanup failure, which main already fixed; this was the one
other TempDir alert manager in internal/monitoring left running.
TestResolveStorageThresholds_HonorsCanonicalPBSDatastoreAlias in
internal/alerts has the same omission. Its manager's one-minute
periodic save recreated the removed directory during a full-package
run (active-alerts.json and intent-pending.json in a leftover
TempDir).
Register t.Cleanup(Stop) right after construction. Cleanups run LIFO,
so Stop joins the checkpoint and periodic workers before the
directory is removed.
With 0-3ms of delay injected before each async checkpoint (go test
-overlay), 50 runs of the first test leaked 18 TempDirs before this
change and none after. A full internal/monitoring run on unfixed main
also leaves that test's directory behind.
Date the evaluated breach through metricStatus rather than publishing poll-varying lifecycle LastSeen. Holds and recovery retain the saved date; unknown dates stay absent and restart rebuilds the volatile status from the existing checkpoint.
Pin exact-trigger and renewed breaches, both restart sources, unchanged recovery-mirror writes, concrete state JSON and keyed websocket withdrawal. Preserve thresholds, notification timing and existing consumer compatibility.
Refs: #2626
Change-source: pulse-maintainer
Reconcile the absent runtime portion of PR2693 aaf5398480 on current assigned source. TrueNAS disk heat follows its disk override, TrueNAS-wide default and inherited per-type policy rather than the system synthetic agent ID. Preserve agent-host overrides, Off, clear thresholds, alert switches, retained-reading limits and canonical identity. Include discriminating resolver, adapter, Patrol and Assistant tests; leave the frontend stack to Web.
Change-source: pulse-maintainer
Gate mail, queue and quarantine reads at the owning poller. Preserve legacy mail defaults while persisting explicit all-off scope, keep missing readings out of alert recovery and reject absent PMG object data. Partial queue observations may prove the highest configured severity but cannot resolve or downgrade alerts. Retain version connectivity separately from downstream poll failure and cover scope, persistence, pause, in-flight and adverse-read boundaries.
Change-source: pulse-maintainer
Merge exact Core candidate 569be6a854. Retain both independent alert contract additions; runtime and test content are unchanged from review. Retained exact-source suites and race proof remain source evidence, not installed delivery.
Change-source: pulse-maintainer
The preceding fixture edit changed its policy entry but omitted changing the reported transport. Bind the disk to the same custom type and resolve the actual fixture transport in its off precondition. Keep all earlier commits and proof failures intact.
Contract-Neutral: Integration fixture alignment only; no runtime or contract change.
Change-source: pulse-maintainer
The first scoped rerun showed SATA zero triggers are normalized back to defaults on configuration save. Use the supported custom transport off entry and verify it is actually disabled before testing pending-run interruption. Preserve the failed proof as fixture evidence; change no runtime behavior.
Contract-Neutral: Integration fixture correction only; runtime and contracts are unchanged.
Change-source: pulse-maintainer
source-v492_pmc passed the selected memory race checks but all eight new temperature subcases counted an independent Unraid array-health alert. Keep the same pending and timing controls and assert the target disk-temperature ID, not the total number of unrelated active alerts. Preserve the original failed receipt; no runtime bytes or product threshold changed.
Contract-Neutral: Correct integration test assertions only; runtime and contracts are unchanged.
Change-source: pulse-maintainer
Additively integrate exact upstream 1a094646d7 while retaining starting reviewed 19a8358a49. Keep reviewed UUID incident/event IDs and upstream non-wrapping atomic sequences for other memory IDs. Compose upstream shared SMART/Unraid temperatures with reviewed pending context and observation-gap interruption; pin Unraid-only continuity and both grace paths. Retain all browser, completion and security validation limits until evidenced.
Change-source: pulse-maintainer
Clone caller-owned inputs before normalising and retaining them in the manager. Later caller edits must not change alert policy or race evaluation and response encoding. Preserve the recent snapshot and persistence ownership repair and atomic partial updates.
Change-source: pulse-maintainer
Stacked on #2698 (which sits on #2694, #2685 and #2679); this PR's own
change is the top commit, "Alert on the Unraid temperature an agent disk
shows", plus a merge of main for an alerts.md anchor both touched.
## Why
A host agent's physical disk can show a temperature that only the host's
Unraid inventory reports:
- a SMART row whose smartctl probe returned no temperature takes its
Unraid row's reading (`HostSMARTDiskTemperature`), and
- a disk only the inventory lists, such as a `--disk-exclude` match, is
built from its Unraid row alone (`HostUnraidDiskTemperature`).
Physical Disks (Temp cell and the `Running Hot` verdict, "at or above
its alert threshold") and Patrol judge that reading against the alert
disk temperature policy, but `CheckHost` only read the SMART row's own
field. A disk could read as at its alert threshold while no alert fired.
Unraid's own warning/critical disk temperature notifications do not make
this redundant: Pulse already alerts on the smartctl readings and array
state of the same hosts, which Unraid also notifies on.
## What changes
- `unifiedresources.HostDiskTemperatureReadings(host)` lists the reading
each of a host's disks shows, built with the registry's own adapters:
one per SMART row the registry ingests, then one per Unraid row whose
disk key no SMART row carries (the same rule as the history writer in
#2698).
- `CheckHost` judges those readings:
- SMART rows keep their `agent:<host>/disk_temp:<device>` resource IDs.
An inventory-only disk uses its block device token, which is the ID a
plain Linux SMART row for that device uses, so a later SMART reading
continues the same alert.
- Per-type thresholds and host overrides use the disk type the disk
shows.
- Only a reading collected now fires or resolves, so a spun-down disk
holds its alert.
- When conflicting serials put two disks on one device, its alert judges
the reading that stands highest against its own type's threshold.
- An inventory-only disk matching the agent's `--disk-exclude` raises
nothing, and an alert it raised before the exclusion resolves on the
next report. This matches the documented exclusion from monitoring and
how linked Proxmox hosts already treat excluded disks.
- Absence cleanup still runs only on a non-empty SMART list.
## Verification
- New alert tests in `internal/alerts/host_unraid_lifecycle_test.go`
cover: the fallback, an inventory-only disk, an empty SMART list, two
disks on one device (also of different types), a controller member under
another device label, standby, exclusion, disk-type and host-override
thresholds, holds, handover to a SMART reading, departure, and the
exclusion clear.
- Each fails on the previous `host.go`.
- Removing any guard (exclusion skip, exclusion clear, disk type,
collected-now, threshold ranking) fails its own test.
- `TestHostDiskTemperatureReadingsMatchTheDisksTheRegistryShows`
compares every reading with the disk the live registry ingests,
including conflicting serials, a virtual device and a MegaRAID member
Unraid lists under its block device.
- `go test ./internal/alerts/... ./internal/unifiedresources/...` passes
on the merged tree, as do the Unraid/SMART/temperature tests in
`internal/monitoring`.
Preserve exact upstream 23bf99e1ba and all reviewed local history. Resolve the sole agent-lifecycle contract conflict by retaining both independent accounts; no frontend source resolution is required. Bound this transaction to the upstream frontier recorded at batch start.
Change-source: pulse-maintainer
## Problem
Saving anything on Alerts > Thresholds turned flapping detection and
alert TTL cleanup off. The page's `PUT /api/alerts/config` body never
carries `flappingEnabled`, `maxAlertAgeDays`, `maxAcknowledgedAgeDays`,
`autoAcknowledgeAfterHours` or `customRules` (the page has no control
for any of them). `UpdateAlertConfig` decoded the body into a zero
`AlertConfig`, so every save wrote `false`/`0` for those fields, reset
the flapping tuning to defaults, dropped custom rules, and persisted
that. The `flapping`, `aggregation` and `ioNormalization` objects the
page sends are not `AlertConfig` fields and never enabled anything.
## Fix
- `PUT /api/alerts/config` now replaces only the top-level keys the body
carries. A key left out keeps its stored value. A sent key replaces its
setting whole, so `"overrides": {}` still clears overrides, and the
usual normalization still runs. A body that is not a JSON object
(including `null`) is a 400 and changes nothing.
- `alertconfig.ApplyAlertConfigUpdate` decodes the body on its own, so
sent keys get exact `encoding/json` semantics, including duplicates and
case-folded keys. It copies every unsent top-level field from a JSON
clone of the stored config.
- `Manager.ApplyConfigUpdate` reads, merges and applies under the
manager lock, so concurrent partial saves cannot revert each other. It
returns an owned snapshot, which the handler persists, so
`SaveAlertConfig`'s in-place normalization no longer writes into the
live config's maps. The handler runs one save at a time, so successful
saves reach `alerts.json` in the order they were applied.
- Stored configs are not rewritten; a value an earlier save zeroed stays
as it is.
## Verification
- Unit: `internal/alerts/config/update_test.go`; manager save path and
concurrent partial updates in
`internal/alerts/config_validation_test.go`; handler against a real
manager in `internal/api/alerting/alerts_test.go`. Each new regression
fails against main's code (overlay negative controls). The concurrency
test fails at round 0 against a non-atomic variant.
- `go test ./internal/alerts/... ./internal/api/alerting/` and the
`internal/api` alert endpoint, tenant and scope tests pass; the alert
tests pass under `-race`.
- Private stack (mock mode, Vite on main's frontend):
- On main, a node CPU change saved from the Thresholds page took
flapping and all three TTLs to false/0, in memory and in `alerts.json`.
- With this change, the same UI save kept them (true/7/1/24) and stored
the new threshold.
- The API repro (GET, drop the four keys, PUT) keeps them; explicit
`false`/`0` still applies; `null` and `[]` return 400.
- Five rounds of concurrent partial PUTs kept both changes in memory and
on disk.
## Follow-ups
- The thresholds page still sends the dead
`flapping`/`aggregation`/`ioNormalization` objects and hard-coded
`minimumDelta`/`suppressionWindow`/`hysteresisMargin`. A frontend
cleanup will follow once the open PRs touching
`alertsConfigurationModel.ts` land.
- `SaveAlertConfig` still normalizes caller-owned maps in place for
other callers (`ActivateAlerts`, startup paths), and the GET handler
encodes a shallow copy. That pre-existing race is tracked separately.
Additively incorporate exact upstream 36d3f8c557 while retaining all accepted local commits and proposal 31eccb559e. Resolve the single adjacent insertion conflict by retaining both reviewed observation-gap interruption and upstream metric tag cleanup. Preserve upstream shared guest and disk-type threshold judgement, phone drawer sizing, future Patrol timing and POST-only Assistant mutations. Exact final validation and outstanding browser/security dispositions remain required before advancing publication.
Change-source: pulse-maintainer
Stacked on #2700 (which carries #2696 and #2692). Merge order is
enforced by the stack: this change must not reach main before #2700's
per-filesystem reevaluation (see "Why stacked" below).
## Problem
`pulse-relaxed` lifts a guest's CPU, memory and disk triggers to a
95/92/95 floor. Only `CheckGuest` applied it. Config-save reevaluation
rebuilt the guest from alert metadata without its tags
(`guestSnapshotFromAlert`), so a save judged a relaxed guest's alert by
its unrelaxed thresholds:
- A relaxed guest with an unset memory threshold alerts at 92 while
polling. On save that reads as no threshold, so the save resolved the
alert and sent a recovery notification, and the next poll raised it
again.
- The floor also lifted an Off threshold (trigger 0, or -1 from the
editors) like any low trigger, so tagging a guest relaxed turned an Off
alert on, with no recovery band (`{95, 0}`). A save then re-judged it
Off and resolved it, and the next poll raised it again.
## Change
- The relaxed step moves into `effectiveAlertPolicyNoLock`'s guest
branch, so `CheckGuest`, config-save reevaluation (including #2700's
`resolveGuestAlertThresholdsNoLock`) and posture checks share one
resolver.
- `guestSnapshotFromAlert` reads the recorded `tags` back, as `[]string`
live or `[]interface{}` after a restart, through a new
`metadataStringsValue` reader. `storagePolicyAliases` now uses the same
reader.
- An Off threshold (trigger <= 0) stays Off under `pulse-relaxed`; an
unset one still gets the floor, as the existing tests pin. The tag is
documented (issue #863) as relaxing thresholds, so it must never make a
guest more sensitive than its config.
- `metricOptionsWithTags` drops the `tags` key from an open alert once
its resource has no tags. Reevaluation now reads that key, so a removed
`pulse-relaxed` left behind would judge the alert by the relaxed trigger
while polling uses the guest's own, and the alert would flap.
Notification tag routing reads the same key, so it also stops routing on
removed tags.
## Why stacked
A filesystem's own override replaces the relaxed guest disk threshold in
`CheckGuest`. On main, reevaluation misses filesystem overrides (fixed
by #2700). With this change alone, a save would judge a relaxed guest's
filesystem alert by the 95 floor instead of, say, an 85 override, and
flap it. `TestConfigSaveKeepsRelaxedGuestFilesystemOverride` fails on
main plus this change and passes on this stack.
## Proof
New tests in `internal/alerts/alerts_test.go` and
`internal/alerts/unified_eval_test.go`. With `go test -overlay` mapping
the six runtime files back to #2700's head, these fail:
- `TestConfigSaveJudgesRelaxedGuestAlertByRelaxedThresholds` (the save
resolved the alert)
- `TestPulseRelaxedKeepsOffGuestThresholdOff` (a disk alert was raised
with disk Off)
- `TestApplyRelaxedGuestThresholds/off_thresholds_stay_off` (Off became
`{95, 0}` / `{92, 0}`)
- `TestCheckGuestDropsRemovedTagsFromOpenAlerts` (stale tags; with only
the metadata assertion relaxed, the save resolves the alert)
`go test ./internal/alerts/... ./internal/notifications/` and the
monitoring alert tests pass.
**Stacked on #2675** (TrueNAS disk temperature alerts by disk type).
Merge that first; this branch contains its commit.
## Problem
A Proxmox physical disk that only the node's own sensors report never
raised a temperature alert:
- `CheckDiskHealth` judges health and wearout only;
- unified evaluation types TrueNAS physical disks, not PVE ones.
So Physical Disks could read a disk **Running Hot** under the per-type
thresholds while alerts stayed silent. Whether a disk alerted depended
on whether a Pulse agent ran on the node: agent-covered disks alert
through `CheckHost` at the same thresholds. #1347 shows users look for
disk temperature thresholds in the Proxmox tabs.
## Change
- **`CheckProxmoxDiskTemperature`**
(`internal/alerts/proxmox_disk_temperature.go`) raises a
`diskTemperature` metric alert under the disk's existing PVE alert
reference. It is judged by the disk temperature policy: the disk type's
`DiskTempByType` entry under the agent Disk Temp default, which switches
it off for every type. The alert carries the disk's serial, WWN and
`diskType`, like the health and wearout alerts.
- **One alert per disk.** `mergeHostAgentSMARTIntoDisks` marks a disk
that a still-reporting linked agent lists in its SMART report
(`AgentSMARTReported`, internal, never serialized). That disk is the
agent's: `CheckHost` alerts on it, and an open PVE alert closes with
`moved_to_agent`. A lapsed agent owns nothing, so the node's own current
readings keep alerting while its agent is silent.
- **Holds and clears.** Only a reading collected this poll is judged
(`diskinventory.TemperatureCollected`), so a retained value holds the
alert. An excluded device, or a switched-off policy, closes it.
- **Stability.** A new `proxmox-disk` alert delay defaults to 5s, so
warnings wait the same 300s noisy-gauge window as agent and TrueNAS disk
temperatures. Critical readings bypass it.
- **Config save.** `reevaluateActiveAlertsLocked` re-judges the alert
per disk type. Without this it would fall through to guest thresholds,
which have no disk temperature, and resolve on every save. An alert
without a recorded type uses the lowest per-type trigger.
- **History.** `ProxmoxPhysicalDiskAlertIdentifiers` lists the new
`<ref>::metric-threshold:diskTemperature` identifier, so resource
history owns its rows by recorded hardware identity, as #2646 does for
health and wearout.
- **Copy.** The Agents "Disk temperature by type" card says it covers
agent, TrueNAS and Proxmox disks.
## Evidence
Private mock stack (8 PVE nodes) with a local-only overlay pinning PVE
disk readings:
| Disk | Physical Disks | Alert |
|---|---|---|
| pve1 NVMe 63°C | Healthy | none |
| pve2 SATA 56°C | Running Hot | warning, trigger 55, after the 300s
window |
| pve3 NVMe 72°C | Running Hot | warning, trigger 70, after the 300s
window |
| pve3 SAS 63°C | Healthy | none |
| pve3 SATA 66°C | Running Hot | critical at once |
The alert card reads: "Samsung 870 EVO 1TB (/dev/nvme2) · Temperature ·
Temperature 66°C, above the 55°C alert level · Clears once it drops to
50°C or lower and stays there for 5 minutes."
## Tests
- `internal/alerts/alerts_test.go`:
- the policy (per type, raised trigger);
- ownership with `moved_to_agent`, the hold without a reading,
exclusion, the off switch;
- the stability window;
- re-judging on save, including the lowest-trigger hold;
- history identifiers.
- `internal/monitoring/physical_disk_roundtrip_test.go`: the marker for
reporting agents only (not a lapsed one), the SMART fallback path, and
that `checkPhysicalDiskAlerts` passes collected readings, ownership and
exclusion.
- `internal/unifiedresources/store_test.go`: a temperature alert row is
owned by its disk and still found by a read by its reference.
- `internal/models/deepcopy_test.go`: the marker survives cloning and
stays out of JSON.
- `ThresholdsTable.test.tsx`: the card copy.
- Ten wiring points were mutation-checked (marker, lease condition,
collected reading, ownership, exclusion, re-judge branch, lowest
trigger, resolution, history identifier); each removal fails a test.
## Second opinion
- Fixed: an offline agent's retained SMART rows kept ownership, so
neither side alerted while the agent was silent. Ownership now needs a
reporting lease.
- Kept, documented in `alerts.md`: on the first poll after an agent is
newly linked to a disk with an open PVE alert, both alerts can be open
until the next disk poll. This is the same window as the node-to-agent
usage alert handover.
## Not in this PR
- Like the health and wearout alerts, a disk that leaves the inventory
keeps its temperature alert until the 24-hour stale sweep.
- Per-host Disk Temp overrides do not reach PVE-only disks, which have
no agent host.
Additively merge upstream 1ac600ec2b without changing accepted commit identities. Compose the shared filesystem threshold resolver with the retained explicit host and linked-node override precedence and canonical metric release; extend the existing regression across configuration save and next report. Keep upstream live-config ownership and Patrol cleanup, alongside all reviewed monitoring work.
Change-source: pulse-maintainer
Stacked on #2696, which is stacked on #2692. The unique commit is the
last one, 539eadfab2.
A config save re-judges every active alert
(`reevaluateActiveAlertsLocked`). Filesystem usage alerts were re-judged
against thresholds their evaluator never uses:
- **Agent filesystems** (`agent:<host>/disk:<label>`) were judged by the
host disk threshold. `CheckHost` judges them by the filesystem's own
override, then the `DiskFillByType` threshold for an inferred hardware
type, then the host threshold.
- **Guest filesystems** (`<guestID>-disk-<key>`) were resolved by the
filesystem's resource ID. That ID matches no `guest-disk:` override and
names no guest, so the guest's own override was missed too.
Example: a filesystem override with trigger 70 raises an alert at 80
under a default of 90. Saving any unrelated alert setting resolved the
alert and sent a recovery notification, and the next poll raised it
again as a new alert.
`CheckHost` and `CheckGuest` now resolve a filesystem's threshold
through `hostDiskUsageThresholdNoLock` /
`guestDiskUsageThresholdNoLock`, and reevaluation calls the same
helpers:
- `resolveHostAlertThresholdsNoLock` applies the host helper for agent
filesystem alerts.
- The new `resolveGuestAlertThresholdsNoLock` resolves a guest
filesystem alert's guest by the ID `parseGuestAlertIdentity` reads from
its resource ID.
Both helpers return override and per-type thresholds as owned copies, so
#2696's rule that evaluation never normalizes the live config still
holds.
`TestConfigSaveJudgesFilesystemAlertsByTheirOwnThreshold` (in
`threshold_resolution_shared_test.go`) covers four cases:
- an agent filesystem override
- an NVMe fill threshold
- a guest filesystem override
- a guest-wide override on a filesystem alert
With `host.go`, `guest.go` and `config_runtime.go` overlaid by their
origin/main or #2696 copies, all four fail at the unchanged save. `go
test ./internal/alerts/...` passes, and the new test plus #2696's
`TestAlertEvaluationLeavesTheLiveConfigToTheLock` pass under `-race`.
Known limits, unchanged by this PR:
- Custom rules that filter on live metrics still see no readings during
reevaluation.
- `pulse-relaxed` is not applied during reevaluation.
- The mock generator's dash-separated guest IDs don't parse as guest
identities.