Skip to content

feat(alerts): poll mjolnir's outlet groups, and record the card's last settings - #1713

Merged
Gerrrt merged 3 commits into
mainfrom
feat/ups-outlet-groups
Nov 24, 2026
Merged

Gerrrt merged 3 commits into
mainfrom
feat/ups-outlet-groups

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 24, 2026

Copy link
Copy Markdown
Owner

What changed

  • Polling. generator.yaml's apc_ups module now walks the card's outlet-group status and config tables, PowerNet .12.1 and .12.2, with the group name as a label. The control table, .12.3, the one that switches groups, is not walked. snmp.yaml is regenerated: 1800 metrics become 1819, and all 7 placeholders survived.
  • Four new rules in ups.rules.yaml.
    • UpsOutletGroupOff, critical: a group has been off or unknown for 5 minutes.
    • UpsOutletGroupLoadShedEnabled, warning: any group has shedding turned on, on time on battery, runtime remaining or overload.
    • UpsOutletGroupDelayChanged, warning: a group's turn-off delay is no longer 90 s, or its turn-on delay no longer 0 s.
    • UpsOutletGroupsUnread, warning: the card answers, but the tables are missing.
  • Tests. ups.test.yaml gives each rule a firing case and a quiet case.
  • Docs.
    • hardware.md replaces the "not read yet" outlet-group paragraph with the values read.
    • It also records the card's users, the SNMPv3 access list and the clock fix.
    • The changelog records all of that, plus Saruman's ADR-0107 settings as the owner checked them on the box.
    • Counts: 210 alert rules, 182 in Prometheus, 188 on the Rules page.

Why

The owner asked for the outlet groups to be watched instead of read by hand, as part of finishing the 2026-11-13 audit of mjolnir. A load shed on group 1 would cut every host before NUT told any of them to halt, and nothing would have noticed one being turned on.

Blast radius

snmp-exporter's apc_ups module gains two table walks. Read first with snmp-walk.sh, they returned 19 and 43 varbinds. The status walk once took 5.4 s while the card stalled, well inside the 45 s scrape timeout. If the module broke, the mjolnir scrape would fail, and up{device="mjolnir"} and the card-silence alerts would say so. One rule pages: a group that is off.

  • 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

  • scripts/snmp-walk.sh --device mjolnir on .12.1, .12.2 and .12.3 read all three groups: on, every shed disabled, 90 s off delay, 0 s on delay. These match what the owner read at the card.

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

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

  • I did not run make validate locally; CI runs it. After the deploy I'll check the new series and 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

…t settings

Walk upsOutletGroupStatus and upsOutletGroupConfig (not the control table).
UpsOutletGroupOff pages on a group off; LoadShedEnabled and DelayChanged warn
on drift from no shedding and 90 s off / 0 s on; UpsOutletGroupsUnread guards
the tables. hardware.md and the changelog record the users, the SNMPv3 access
list, the clock fix and Saruman's ADR-0107 settings as checked on the box.

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

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

Changes are needed because incomplete or missing outlet-group telemetry can evade safety alerts, and the paging documentation overlooks outages that disable monitoring or notifications and require the external Watchdog fallback.

2 open issues
What changed in this PR

This PR adds outlet-group monitoring for mjolnir to the observability stack and records the UPS card’s audited settings.

Changes:

  • Adds SNMP status and configuration polling with outlet-group names as labels, excluding the control table.
  • Adds four alerts and associated tests for outlet state, load shedding, delay changes, and missing readings.
  • Records audit results and updates documentation to reflect 210 alert rules, including 182 in Prometheus.
File Description
stacks/​observability/​snmp-exporter/​snmp.yaml Adds generated outlet-group metrics and labels.
stacks/​observability/​snmp-exporter/​generator.yaml Configures table walks and group-name lookups.
stacks/​observability/​README.md Updates the Prometheus alert count.
stacks/​observability/​prometheus/​tests/​ups.test.yaml Adds firing and quiet outlet-alert fixtures.
stacks/​observability/​prometheus/​rules/​ups.rules.yaml Adds four outlet monitoring alerts.
README.md Updates overall and Prometheus alert totals.
docs/​security.md Updates the documented alert total.
docs/​runbooks/​deploy-stack.md Updates the expected Rules page count.
docs/​observability.md Updates alert and test coverage counts.
docs/​hardware.md Records outlet settings, card accounts, access restrictions, and clock correction.
docs/​changelog.md Records monitoring additions and audit results.

Review effort: Balanced

Comment thread docs/hardware.md Resolved
Gerrrt and others added 2 commits November 24, 2026 06:17
…roups; say group-off pages only for group 2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit ffbcf1f into main Nov 24, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the feat/ups-outlet-groups branch November 24, 2026 06:31
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