Skip to content

fix(alerts): stopped-collector rules hold for two weeks, not a day - #1585

Merged
Gerrrt merged 4 commits into
mainfrom
fix/patch-state-stopped-absence
Nov 19, 2026
Merged

Gerrrt merged 4 commits into
mainfrom
fix/patch-state-stopped-absence

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 19, 2026

Copy link
Copy Markdown
Owner

What changed

  • PatchStateStopped (host.rules.yaml and lab.rules.yaml) and GuestStateStopped (host.rules.yaml) look back [14d] offset 6h instead of [1d] offset 6h. Comments and descriptions say why, and that a host retired on purpose now fires for two weeks.
  • New promtool cases in host.test.yaml and lab.test.yaml: a collector that stops still fires at 3 d and 10 d, and is quiet at 16 d.
  • build-the-sensor-guest.md §3 removes cloud-init's 50-cloud-init.conf and checks that only 10-homelab.conf is left.
  • docs/changelog.md: a 2026-11-19 heading with three entries: the rule fix, alexander's phased security updates, and fenrir's drop-in.

Why

Review of #1580's ApplianceStateStopped found that the "reported before, not in the last six hours" form these rules copied empties its left side about 30 h after the last sample, so the alert resolved by itself while the collector was still dead. The 2026-11-13 audit had to guess fenrir's sshd from the 27-byte PasswordAuthentication yes file, which the 10- drop-in already outranked; removing it means the next audit has nothing to flag.

Refs #1580

Blast radius

  • Rule changes only take effect after make up STACK=observability on the estate host and make up STACK=lab on alexander.
  • A host whose collector was removed on purpose in the last 14 days will start firing PatchStateStopped on reload; silence it.
  • The runbook change already applied on fenrir by hand: only 10-homelab.conf remains, ssh is active, and the appliance check's sshd row reads 1.

Verification

  • promtool test rules passes for host.test.yaml and lab.test.yaml; promtool check rules loads 62 and 25 rules.
  • Mutation: with [1d] restored, the 3 d and 10 d cases fail.
  • python3 scripts/check_docs.py: OK.
  • ./scripts/lint.sh on the Mac: same result as main; markdownlint-cli2, zizmor, packer, tofu and editorconfig-checker skipped (no Docker), ansible-lint fails as on main. CI runs them all.

🤖 Generated with Claude Code

PatchStateStopped (estate and lab) and GuestStateStopped looked back
[1d] offset 6h, so about 30 h after the last sample the "was reporting"
side emptied and the alert resolved with nothing recovered. They now
look back 14 days, inside both Prometheuses' retention. New promtool
cases fire at 3 d and 10 d and are quiet at 16 d; with [1d] put back
the 3 d and 10 d cases fail.

The sensor runbook's sshd step also removes cloud-init's
50-cloud-init.conf, now removed on fenrir. The changelog records both,
and that alexander's pending security updates are Ubuntu's phasing.

Refs #1580

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 18:52
…ch-state-stopped-absence

# Conflicts:
#	docs/changelog.md
@Gerrrt
Gerrrt enabled auto-merge (squash) November 19, 2026 18:54

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 stopped-guest expiry lacks a 16-day test, the changelog overstates detection of stopped collectors, and the lab retirement guidance recommends silencing an alert without Alertmanager.

3 open issues
What changed in this PR

Extends the HomeLab’s missing-series alerts so they remain active for roughly two weeks instead of clearing after about a day. It also documents SSH drop-in cleanup for the sensor guest.

Changes:

  • Expands patch-state and guest-state alert lookbacks to 14 days.
  • Adds long-gap regression cases for the updated alerts.
  • Updates the sensor runbook and records the alert changes and operational observations.
File Description
stacks/​observability/​prometheus/​tests/​host.test.yaml Adds long-gap patch-state and guest-state alert cases.
stacks/​observability/​prometheus/​rules/​host.rules.yaml Extends patch-state and guest-state lookbacks and updates explanations.
stacks/​lab/​prometheus/​tests/​lab.test.yaml Tests patch-state firing at 3 and 10 days, then expiry at 16 days.
stacks/​lab/​prometheus/​rules/​lab.rules.yaml Extends the missing patch-state series lookback.
docs/​runbooks/​build-the-sensor-guest.md Removes cloud-init’s SSH drop-in and checks the remaining configuration.
docs/​changelog.md Records alert changes, phased updates, and SSH cleanup.

Review effort: Balanced

Comment thread docs/changelog.md Resolved
Gerrrt and others added 2 commits November 19, 2026 11:09
Review on #1585:
- The estate's PatchStateStopped and GuestStateStopped see a series
  vanish, not a timer that stops and leaves its .prom file, which is
  re-served on every scrape. The rule comments and changelog now say
  so; the lab's copy has an mtime branch, the estate's do not yet.
- The lab has no Alertmanager (ADR-0020), so its rule comment no
  longer says to silence a retired guest.
- GuestStateStopped's long-gap test now also asserts quiet at 16 d.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ch-state-stopped-absence

# Conflicts:
#	docs/changelog.md
@Gerrrt
Gerrrt merged commit 4ab2be7 into main Nov 19, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the fix/patch-state-stopped-absence branch November 19, 2026 19:41
Gerrrt added a commit that referenced this pull request Nov 19, 2026
PatchStateStopped and GuestStateStopped fired only when their series
vanished. A collector whose timer stops leaves its .prom in the textfile
directory and node_exporter re-serves it, so the series stays present and
neither rule saw it. Each gains a second branch on
node_textfile_mtime_seconds, as the lab's PatchStateStopped has (#1544):
apt-patch-state.prom older than two days, guest-state.prom older than an
hour, with label_replace copying `instance` into `host`.

Promtool cases fire with the file frozen and stay quiet with it rewritten
beside an old file of another collector; removing either branch or
loosening either regex to `.*state\.prom` fails them.

Refs #1585.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gerrrt added a commit that referenced this pull request Nov 19, 2026
…ile (#1587)

PatchStateStopped and GuestStateStopped fired only when their series
vanished. A collector whose timer stops leaves its .prom in the textfile
directory and node_exporter re-serves it, so the series stays present and
neither rule saw it. Each gains a second branch on
node_textfile_mtime_seconds, as the lab's PatchStateStopped has (#1544):
apt-patch-state.prom older than two days, guest-state.prom older than an
hour, with label_replace copying `instance` into `host`.

Promtool cases fire with the file frozen and stay quiet with it rewritten
beside an old file of another collector; removing either branch or
loosening either regex to `.*state\.prom` fails them.

Refs #1585.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Gerrrt added a commit that referenced this pull request Nov 19, 2026
…ile off

Redeploying the lab after #1585 put PatchStateStopped in pending for
eden: it stopped reporting at its rebuild on 2026-11-13, because the old
guest's timer was installed by hand and build-the-bloodhound-guest.md
had no such step. The [1d] window had cleared the alert by 11-14.

- The runbook's section 6 installs the patch-state collector; it is
  installed on eden and the lab reads it.
- eden is on-demand (ADR-0079), so the rule's vanished-series branch
  leaves it out while none of its node metrics have arrived in an hour.
  A running eden with a dead collector still fires.
- promtool: shut-down eden quiet at 3d and 10d, running eden without
  its collector fires; removing the exclusion fails the first case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gerrrt added a commit that referenced this pull request Nov 19, 2026
…ile off (#1588)

Redeploying the lab after #1585 put PatchStateStopped in pending for
eden: it stopped reporting at its rebuild on 2026-11-13, because the old
guest's timer was installed by hand and build-the-bloodhound-guest.md
had no such step. The [1d] window had cleared the alert by 11-14.

- The runbook's section 6 installs the patch-state collector; it is
  installed on eden and the lab reads it.
- eden is on-demand (ADR-0079), so the rule's vanished-series branch
  leaves it out while none of its node metrics have arrived in an hour.
  A running eden with a dead collector still fires.
- promtool: shut-down eden quiet at 3d and 10d, running eden without
  its collector fires; removing the exclusion fails the first case.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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