From baba57ff1cd10e0645ce0ccd1a15b19cd1fdbdd9 Mon Sep 17 00:00:00 2001 From: Gerrrt Date: Wed, 25 Nov 2026 03:07:44 +0000 Subject: [PATCH] fix(agent-collectors): gate thin-pool-state and range-state on their hosts The installer installs a row wherever its requirement exists. thin-pool-state required lvs and range-state required nft, and an Ubuntu guest such as alexander has both, so a full run there would have put Saruman's pool collector and gandalf's range collector on a lab guest. thin-pool-state now requires pveversion; range-state requires the stop helper it reads its deadline from. The units' ConditionPathExists match. Co-Authored-By: Claude Opus 5.5 --- docs/changelog.md | 15 +++++++++++++++ scripts/install-agent-collectors.sh | 16 ++++++++++++++-- systemd/agent/homelab-range-state.service | 2 +- systemd/agent/homelab-thin-pool-state.service | 2 +- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 9a00eea89..2e688ec2e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -61,6 +61,21 @@ docstring gives: it is a record, not a claim about now. The `pre449weaknesses` snapshots and the fs-freeze timeouts on `titan` and `ramuh` are not part of the runbook and are unchanged. +- **Two agent collectors no longer qualify for every Ubuntu guest.** + `install-agent-collectors.sh` installs a row on any host where its + requirement exists. `thin-pool-state` required `lvs` and `range-state` + required `nft`, and `alexander` has both, from the installer's LVM layout + and from `nftables` coming in with `ubuntu-standard` and Docker's + `iptables`. A full run there would have installed `Saruman`'s pool + collector and `gandalf`'s range collector on a lab guest. Re-checking + the audit of `alexander` found it. `thin-pool-state` now requires + `pveversion`, and `range-state` requires + `/usr/local/sbin/homelab-ragnarok-stop`, the helper it reads its deadline + from. Both units' `ConditionPathExists` match. The installed units on + `Saruman` and `gandalf` now differ from the committed ones, so `--check` + reports them stale until `--only thin-pool-state` and `--only range-state` + are re-run there. + - **`neo` is on RouterOS 7.24.7 long-term.** Upgraded from 7.24.6 at 01:00 UTC under a one-hour silence on `component=~"internet|network"`, after a verified `make backup-switch`. The download staged in RAM and left diff --git a/scripts/install-agent-collectors.sh b/scripts/install-agent-collectors.sh index 275383b17..4ea309b05 100755 --- a/scripts/install-agent-collectors.sh +++ b/scripts/install-agent-collectors.sh @@ -70,6 +70,18 @@ # which lasted exactly as long as it took for the second collector to need # shipping. # +# A REQUIREMENT MUST BE SOMETHING ONLY THE INTENDED HOSTS HAVE, not merely +# something the collector calls. thin-pool-state calls lvs and range-state +# calls nft, and both were first gated on them. An Ubuntu guest installed +# from the ISO has both: the installer's LVM layout brings lvm2, and nftables +# comes with ubuntu-standard and with iptables, which Docker depends on. So a +# full run against `alexander` would have put Saruman's pool collector and +# gandalf's range collector on a lab guest (found re-checking the alexander +# audit on 2026-11-25). thin-pool-state now requires pveversion, as +# pve-version does, so it lands on the hypervisors only. range-state requires the stop helper it reads its deadline from, +# /usr/local/sbin/homelab-ragnarok-stop, which only gandalf has. Each unit's +# ConditionPathExists names the same path. +# # drift-check's requirement is not a binary but the wiki checkout's own guard # script, which exists on exactly the host that holds the wiki — oracle — and # nowhere else. That is the per-collector check doing its job: every other host @@ -122,12 +134,12 @@ COLLECTORS=( "pve-version scripts/collect-pve-version.sh pve-version.prom /usr/bin/pveversion" "cert-expiry scripts/collect-cert-expiry.sh cert-expiry-HOST.prom /usr/bin/pveproxy" "guest-state scripts/collect-guest-state.sh guest-state.prom /usr/sbin/qm" - "thin-pool-state scripts/collect-thin-pool-state.sh thin-pool-state.prom /usr/sbin/lvs" + "thin-pool-state scripts/collect-thin-pool-state.sh thin-pool-state.prom /usr/bin/pveversion" "guest-disk-state scripts/collect-guest-disk-state.sh guest-disk-state.prom /usr/sbin/qm" "guest-service-state scripts/collect-guest-service-state.sh guest-service-state.prom /usr/sbin/qm" "wazuh-manager-state scripts/collect-wazuh-manager-state.sh wazuh-manager-state.prom /srv/soc-data" "pve-firewall-state scripts/collect-pve-firewall-state.sh pve-firewall-state.prom /usr/sbin/pve-firewall" - "range-state scripts/collect-range-state.sh range-state.prom /usr/sbin/nft" + "range-state scripts/collect-range-state.sh range-state.prom /usr/local/sbin/homelab-ragnarok-stop" "iso-store-state scripts/collect-iso-store-state.sh iso-store-state.prom /mnt/smaug-iso" "zeek-mirror scripts/zeek-mirror.sh - /usr/sbin/qm" "zeek-mirror-state scripts/collect-zeek-mirror-state.sh zeek-mirror-state.prom /usr/sbin/qm" diff --git a/systemd/agent/homelab-range-state.service b/systemd/agent/homelab-range-state.service index c0458462a..0e2030f0c 100644 --- a/systemd/agent/homelab-range-state.service +++ b/systemd/agent/homelab-range-state.service @@ -15,7 +15,7 @@ Description=HomeLab: record the range host's own controls (ADR-0126) Documentation=file:///home/robo/code/Gerrrt/HomeLab/docs/runbooks/schedule-maintenance.md ConditionPathIsDirectory=/var/lib/node_exporter/textfile_collector -ConditionPathExists=/usr/sbin/nft +ConditionPathExists=/usr/local/sbin/homelab-ragnarok-stop [Service] Type=oneshot diff --git a/systemd/agent/homelab-thin-pool-state.service b/systemd/agent/homelab-thin-pool-state.service index 59362a2c4..65a2235bb 100644 --- a/systemd/agent/homelab-thin-pool-state.service +++ b/systemd/agent/homelab-thin-pool-state.service @@ -21,7 +21,7 @@ Description=HomeLab: record how full this hypervisor's thin pools are Documentation=file:///home/robo/code/Gerrrt/HomeLab/docs/runbooks/schedule-maintenance.md ConditionPathIsDirectory=/var/lib/node_exporter/textfile_collector -ConditionPathExists=/usr/sbin/lvs +ConditionPathExists=/usr/bin/pveversion [Service] Type=oneshot