feat(monitoring): NAS storage health alerts (#10) #14
No reviewers
Labels
No labels
ready-for-agent
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bryan/nix-configs!14
Loading…
Reference in a new issue
No description provided.
Delete branch "n10-5-nas-storage-health"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #10 (piece N10.5): alert rules for NAS storage health.
What changes
A new module,
services.nas-storage-health, alerts on NAS storage faults from two signals. Neither relies on the filesystem's read-only flag, which can lag a failed pool.unraid-nodejob) exports per-device btrfs error counters.NasBtrfsDeviceErrors(critical) fires on any increase over 30 minutes, per device and error type; counts that are already there never fire.NasBtrfsMetricsMissing(warning) covers the collector failing, or a filesystem seen in the last day vanishing while the exporter is up.org.nixos.nas-write-probe, every 10 minutes) runsscripts/nas-write-probe.sh: for each configured share it checks for a live smbfs mount, checks the directory, writes a small file there, reads it back, compares and deletes it, every step that touches the share under a timeout, retrying once. A run that is stopped removes its file; a directory outside its mount point is refused. It writesnas_write_probe_*metrics for node_exporter's textfile collector.NasWriteProbeFailed(critical, two runs),NasShareNotMountedandNasWriteProbeSilent(warnings) follow.Backupsdirectory.modules/services/AGENTS.mdand the README describe it. One assertion intest_fseventsd_watchdog.pyassumed the watchdog was the only textfile/rule contributor on Studio; it now checks only that none of the watchdog's remain.Checks
python3 scripts/test_nas_storage_health.py(31): the probe against stand-in mounts (writable, read-only, unmounted, non-SMB, missing directory, a hanging write, a hanging directory check, a failed write that left a file, a stopped run, stale read-back, a blip that passes on retry, two shares; the metrics file replaced whole); Studio's agent and node_exporter wiring; a host without monitoring; the refusals;promtool check rules;promtool test ruleson series in the shape the NAS's exporter records, where a mirrored pool's devices drop off and the read-only flag stays 0. Mutations fail the tests: a raised threshold, a short window, the rule rewritten onto the read-only metric, removing theupandmountedguards, the read-back comparison, the retry, the cleanup paths, the timed directory check, the atomic metrics write, the mount-point check and the grouped summary.scripts/test_*.pypass;darwin-rebuild build --flake .#studiobuilds.Review
An independent read-only Pi reviewer approved with two should-fixes (an untimed directory check on the share; an untested cleanup path) and seven nits; all fixed with tests, re-review approved, and its two follow-up nits (stop timeout, tests for the rule tweaks) fixed with tests.
Live after the next
update-system.