Skip to content

feat(alerts): watch mjolnir's pack age and input sensitivity - #1709

Merged
Gerrrt merged 3 commits into
mainfrom
feat/ups-pack-age-sensitivity
Nov 24, 2026
Merged

Gerrrt merged 3 commits into
mainfrom
feat/ups-pack-age-sensitivity

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 24, 2026

Copy link
Copy Markdown
Owner

What changed

Prometheus now reads two more values off mjolnir's card, and three new warnings watch them:

  • UpsBatteryPackAging warns when the pack is three years old, by the card's Last Battery Replacement date. The card stores that date as a month and year. generator.yaml splits upsBasicBatteryLastReplaceDate into ...Year and ...Month with a regex. The current pack reaches three years in August 2029.
  • UpsInputSensitivityChanged warns when upsAdvConfigSensitivity has been anything but medium (3) for 30 minutes.
  • UpsCardReadingMissing warns when the card answers SNMP but either reading is absent, so the two rules above can't sit quietly on nothing.

The other changes:

  • snmp.yaml is regenerated with make snmp-generate. The metric count went from 1798 to 1800, and all 7 placeholders survived.
  • ups.test.yaml gives each new rule a firing case and a quiet case.
  • The rule counts move to 206 total, 178 in Prometheus, and 184 on the Rules page.
  • hardware.md, fit-the-ups-battery.md step 5 and the changelog are updated.

Why

The owner asked for both after the 2026-11-13 audit of mjolnir. Nothing reminded anyone of the pack's age. Nothing would notice if sensitivity went back to high, which a card reset would do without a word. Medium was set on 2026-11-24, after three transfers to battery in a month for distorted input.

Blast radius

The change touches snmp-exporter's apc_ups module, adding two GETs to the card's scrape. A broken module would fail the mjolnir scrape, and up{device="mjolnir"} and the card-silence alerts would say so. The three new rules are warnings only.

  • No change to network segmentation or firewall rules
  • No new port published to a VLAN that could not already reach the service
  • No credential added outside secrets/*.sops.yaml

Verification

  • Both OIDs were read off the card first with scripts/snmp-walk.sh --device mjolnir. .2.1.3.0 returned "08/15/2026" and .5.2.7.0 returned 3.

  • promtool test rules tests/ups.test.yaml, run in the pinned image, reports SUCCESS.

  • python3 scripts/check_docs.py and ./scripts/lint.sh pass.

  • I did not run make validate locally; CI runs it. After the deploy I'll check the three new series and the rules on the live Prometheus.

  • make validate passes

  • Deployed to the lab and confirmed working

  • Docs updated (docs/, service README, or docs/roadmap.md)

🤖 Generated with Claude Code

Read upsBasicBatteryLastReplaceDate (split into Year and Month by regex) and
upsAdvConfigSensitivity off the card. UpsBatteryPackAging warns at three
years, UpsInputSensitivityChanged when it leaves medium, and
UpsCardReadingMissing if either reading disappears.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 24, 2026 04:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The alert’s diagnostic command is unusable because it passes two readings to a script that accepts one numeric OID and includes an invalid OID; both the annotation and its expected test value need correction.

1 open issue
What changed in this PR

This PR extends the existing SNMP and Prometheus monitoring for mjolnir to track battery-pack age and detect changes to input sensitivity.

Changes:

  • Adds battery-replacement date extraction and input-sensitivity collection.
  • Adds three warning rules for pack age, sensitivity changes, and missing readings, with firing and quiet test cases.
  • Updates operational documentation and alert counts to 206 total, including 178 Prometheus alerts.
File Description
stacks/​observability/​snmp-exporter/​snmp.yaml Adds generated scalar GETs and metric definitions.
stacks/​observability/​snmp-exporter/​generator.yaml Configures new readings and year/month extraction.
stacks/​observability/​README.md Updates the Prometheus alert count.
stacks/​observability/​prometheus/​tests/​ups.test.yaml Adds firing and quiet cases for all three warnings.
stacks/​observability/​prometheus/​rules/​ups.rules.yaml Defines pack-age, sensitivity-change, and missing-reading alerts.
README.md Updates overall and Prometheus alert totals.
docs/​security.md Updates the monitoring coverage count.
docs/​runbooks/​fit-the-ups-battery.md Connects setting the replacement date to clearing the age warning.
docs/​runbooks/​deploy-stack.md Updates the expected Rules page count.
docs/​observability.md Updates alert totals and documented test coverage.
docs/​hardware.md Documents the new UPS warnings and pack-age threshold.
docs/​changelog.md Records the monitoring additions and verification.

Review effort: Balanced

Gerrrt and others added 2 commits November 24, 2026 05:13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit e8e0d69 into main Nov 24, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the feat/ups-pack-age-sensitivity branch November 24, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants