From d2e9cadf186daab2c0be8ba63c4aa3dccc8a658f Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Thu, 17 Sep 2026 23:44:21 +0000 Subject: [PATCH] fix(prometheus): name the laptop cell runbook, not the UPS one (#454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HostBatteryHealthLow reads a laptop cell's measured full capacity against its design figure, and fires today for oracle's BAT0 at 72 %. Its description sent the reader to docs/runbooks/fit-the-ups-battery.md, which is the rack pack in mjolnir: an APCRBC115 in a Smart-UPS, a self-test to watch and an NMC to read. None of that is what you do with a thirteen-year-old cell in a laptop on a shelf, so the one alert whose whole action is "order the replacement" pointed at the wrong hardware. It now names docs/runbooks/replace-the-laptop-cell.md, which carries the baseline to take first, the fit, the mains-pull test that proves it, the stack-down window and the disposal. Because that runbook covers the before as well as the after, the sentence reads "what to check before and after the swap" rather than only after. That runbook lands with #497, which is still open — this change should not merge ahead of it, or the annotation names a path that does not yet exist on main. The description is asserted verbatim in two exp_annotations blocks in tests/host.test.yaml, so the rule and both assertions move together. Line-wrapping differs between the two files and always has; the folded scalars were compared as strings to confirm they still produce identical text. HostOnBattery and HostBatteryNotReported were checked and left alone: neither names a runbook, so neither had a wrong one. Each already carries its own next step in prose — UpsOnBattery and node_power_supply_capacity for the first, /sys/class/power_supply for the second. The fit-the-ups-battery.md reference in the block's header comment also stays: it cites that document for stating the shelf's mains-cut design, which is still true, not for how to change a cell. Verified: `promtool test rules` on tests/host.test.yaml via docker with the pinned prom/prometheus:v3.14.0 image (the Makefile's check-rules target calls a bare `promtool`, which is not on PATH on this host) — SUCCESS. Reverting one of the two assertions to the old path was confirmed to FAIL the run, proving the annotation is genuinely asserted and not silently ignored. `./scripts/validate.sh` exits 0, all checks passed, including "observability: promtool test rules (11 file(s))"; the 3 skips are the systemd unit checks that only run in the deployment checkout. Refs #454 Co-Authored-By: Claude Opus 5 --- stacks/observability/prometheus/rules/host.rules.yaml | 5 +++-- stacks/observability/prometheus/tests/host.test.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/stacks/observability/prometheus/rules/host.rules.yaml b/stacks/observability/prometheus/rules/host.rules.yaml index af812af6..64dc1553 100644 --- a/stacks/observability/prometheus/rules/host.rules.yaml +++ b/stacks/observability/prometheus/rules/host.rules.yaml @@ -560,8 +560,9 @@ groups: The cell's full charge as its firmware measures it, against the capacity it was built with. Below 80 % the runtime on a mains cut is a guess, and a cell this far into its life is also the one that - swells. Order the replacement — docs/runbooks/fit-the-ups-battery.md - says what to check after the swap. + swells. Order the replacement — + docs/runbooks/replace-the-laptop-cell.md says what to check before + and after the swap. - alert: HostBatteryNotReported # A laptop that should have a battery and reports none: the cell was diff --git a/stacks/observability/prometheus/tests/host.test.yaml b/stacks/observability/prometheus/tests/host.test.yaml index 0ebc2f37..84c31581 100644 --- a/stacks/observability/prometheus/tests/host.test.yaml +++ b/stacks/observability/prometheus/tests/host.test.yaml @@ -1074,8 +1074,8 @@ tests: capacity it was built with. Below 80 % the runtime on a mains cut is a guess, and a cell this far into its life is also the one that swells. Order the replacement — - docs/runbooks/fit-the-ups-battery.md says what to check after - the swap. + docs/runbooks/replace-the-laptop-cell.md says what to check + before and after the swap. # --- HostBatteryHealthLow: the energy_* spelling counts too --------------- # A driver reporting watt-hours instead of amp-hours. 30 of 50 is 60 %. @@ -1103,8 +1103,8 @@ tests: capacity it was built with. Below 80 % the runtime on a mains cut is a guess, and a cell this far into its life is also the one that swells. Order the replacement — - docs/runbooks/fit-the-ups-battery.md says what to check after - the swap. + docs/runbooks/replace-the-laptop-cell.md says what to check + before and after the swap. # --- HostBatteryHealthLow: QUIET for prometheus's real reading ------------- # 6.196 Ah of 6.6 Ah is 94 %, read on 2026-09-12 after 108 cycles. Without