Skip to content

fix(alerts): UpsOnBattery pages on a transfer one scrape catches - #1704

Merged
Gerrrt merged 2 commits into
mainfrom
fix/ups-on-battery-short
Nov 24, 2026
Merged

Gerrrt merged 2 commits into
mainfrom
fix/ups-on-battery-short

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 24, 2026

Copy link
Copy Markdown
Owner

What changed

UpsOnBattery was upsSecondsOnBattery > 0 for 30s. It is now max_over_time(upsSecondsOnBattery[2m]) > 30 with no for, so any scrape that reads more than 30 seconds on battery pages. ups.test.yaml gains a case that replays the 2026-11-21 transfer, read once at 42 s, which fires. The same case replays the 1-second transfer of 2026-11-07, which does not. shut-down-on-the-ups.md now gives the page's outside limit as two and a half minutes. There is also a changelog entry.

Why

On 2026-11-21 the UPS ran on battery for 82 seconds, and nothing paged. Scrapes are a minute apart, so only one read the transfer. The alert went pending and cleared before its for could run out. The finding came from reading the card's event log during the mjolnir audit.

Blast radius

Paging for mjolnir only. The risk is extra pages: a transfer that lasts 30 to 90 seconds now pages, where before it could pass silently. It also stays firing for up to two minutes after mains return.

  • 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

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

  • ./scripts/lint.sh: passes.

  • python3 scripts/check_docs.py: passes.

  • Prometheus history for 2026-11-21: upsSecondsOnBattery read 42 at 17:53 UTC, and ALERTS{alertname="UpsOnBattery"} was pending at 17:54 only.

  • make validate was not run locally; CI runs it.

  • make validate passes

  • Deployed to the lab and confirmed working

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

🤖 Generated with Claude Code

The 82-second transfer of 2026-11-21 was read once at 42 s; '> 0 for 30s'
went pending and cleared. Fire on max_over_time(...[2m]) > 30 instead, and
replay both the 11-21 and the 1-second 11-07 transfers in ups.test.yaml.

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

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 timing claim omits the 45-second SNMP scrape timeout and conflates rule firing with page delivery, risking premature attribution of a missing page to the card.

1 open issue
What changed in this PR

This PR updates UPS alerting so a single scrape observing more than 30 seconds on battery can trigger UpsOnBattery, addressing the missed 82-second transfer.

Changes:

  • Replaces the 30-second pending period with a two-minute lookback.
  • Adds regression coverage for the observed 42-second reading and a one-second transfer that should not alert.
  • Updates troubleshooting timing guidance and records the change.
File Description
stacks/​observability/​prometheus/​tests/​ups.test.yaml Adds short-transfer firing, non-firing, and clearing checks.
stacks/​observability/​prometheus/​rules/​ups.rules.yaml Uses max_over_time(...[2m]) > 30 without a pending period.
docs/​runbooks/​shut-down-on-the-ups.md Revises the documented alert timing allowance.
docs/​changelog.md Records the missed transfer and alerting change.

Review effort: Balanced

Comment thread docs/runbooks/shut-down-on-the-ups.md Resolved
@Gerrrt
Gerrrt enabled auto-merge (squash) November 24, 2026 03:53
…plits firing from delivery

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
auto-merge was automatically disabled November 24, 2026 04:01

Pull Request is not mergeable

@Gerrrt
Gerrrt merged commit 9b1c48a into main Nov 24, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the fix/ups-on-battery-short branch November 24, 2026 04:14
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