Repository navigation
feat(observability): the range monitoring of ADR-0126 (#1651) - #1679
Merged
Merged
Conversation
…oyed (#1651) A collector for gandalf's own controls (collect-range-state.sh: the vmbr1 ingress barrier, vmbr0/sshd forwarding, and the ragnarok stop timer), a deadline-epoch subcommand on ragnarok-stop.sh so the monitor reads the timer's own effective deadline, and six range.rules.yaml alerts with promtool tests: PveFirewallZeroRules, the barrier/forwarding checks, and the stop timer failing. install-agent-collectors.sh gains the row; §7 gains the host-only install steps. Not host uptime — an always-on host has no fault there. Counts trued up, including the inherited 126->127 ADR count. The morpheus pass, a metrics-only Alloy config, and the live deploy need the lab and are flagged, not in this change. Refs #1651. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Missing systemd units break installation, while collector error handling, forwarding detection, and missing freshness alerts can leave unsafe conditions unreported.
6 open issues
Treat local and remote SSH forwarding as enabled · New Publish zero when the nft ingress chain is missing · New Reject invalid deadline state and require helper upgrades · New Add the missing range-state systemd service and timer · New Alert when range-state metrics become stale · New Defer the deadline alert during confirmed package installs · New
What changed in this PR
Implements the repository-side monitoring for always-on range host gandalf under ADR-0126. Live deployment remains deferred until the firewall pass and metrics-only agent support are ready.
Changes:
- Adds a host-control collector and machine-readable Ragnarok stop deadline.
- Adds six Prometheus alerts with firing and quiet test cases.
- Documents deployment prerequisites and updates alert and ADR counts.
| File | Description |
|---|---|
stacks/observability/README.md |
Updates alert count and adds range coverage. |
stacks/observability/prometheus/tests/range.test.yaml |
Tests firing and quiet cases for six alerts. |
stacks/observability/prometheus/rules/range.rules.yaml |
Adds firewall, forwarding, ingress, and stop-timer alerts. |
scripts/self-tests.sh |
Documents the new collector’s parser fixtures. |
scripts/README.md |
Lists the range-state collector. |
scripts/ragnarok-stop.sh |
Adds deadline-epoch output and fixtures. |
scripts/install-agent-collectors.sh |
Registers the range-state collector. |
scripts/collect-range-state.sh |
Exports range host controls and stop-timer metrics. |
README.md |
Updates alert and ADR totals. |
docs/security.md |
Updates the alert total. |
docs/runbooks/deploy-stack.md |
Updates expected loaded-rule count. |
docs/runbooks/build-the-playground.md |
Documents host-only monitoring and pending deployment prerequisites. |
docs/observability.md |
Documents range alerts and updates coverage counts. |
docs/changelog.md |
Records implementation and outstanding deployment work. |
Review effort: Balanced
…eview Review on #1679: - Add systemd/agent/homelab-range-state.{service,timer}; the installer requires the unit pair for every row, so without it --only range-state and every default install failed. - collect-range-state.sh: survive an absent nft table under set -e; treat a failed or malformed deadline-epoch as unknown, not a stopped VM; and AllowTcpForwarding local/remote now count as forwarding on (only no is off). - The stop timer records a dpkg deferral; the collector exports it and RagnarokPastDeadline excludes it, so a protected install past the deadline does not read as a failed timer. - Add RangeStateStale: the textfile exporter keeps serving old values when the collector stops, so a barrier that falls afterwards would read healthy. - §7 upgrades the stop helper before the collector; counts trued up. Refs #1651. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…f-build # Conflicts: # README.md # docs/changelog.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What changed
The repo half of #1651 — the collector, rules, tests and docs ADR-0126 commissions. Fully testable here; the live deploy (firewall pass, metrics-only agent, converge) is flagged below.
scripts/collect-range-state.sh(new): readsgandalf's own range controls — thevmbr1_host_iningress barrier,vmbr0andsshdforwarding, and theragnarokstop timer with its effective deadline. Host-only (ADR-0028 class), with a--self-testfor its parsers.scripts/ragnarok-stop.sh: adeadline-epochsubcommand so the monitor reads the timer's own effective deadline (extensions anddpkgwaits folded in) rather than a second copy of the logic. New self-test fixtures.range.rules.yaml+range.test.yaml(new): six alerts, each with a firing and a quiet promtool test —PveFirewallZeroRules— firewall enabled, DROP policy, zero host rules (the metric existed; no rule read it).RangeIngressBarrierDown,RangeHostForwardingOn,RangeSshForwardingOn— the §2/§4 controls the firewall collector can't see.RagnarokStopTimerInactive,RagnarokPastDeadline— the ADR-0125 timer failing (not a fixed 12h bound).install-agent-collectors.sh: arange-staterow.build-the-playground.md§7: a Monitoring the host subsection — themorpheuspass, the host-only collector install (noguest-disk-state), and the metrics-only agent requirement. Marked not yet deployed.Host uptime is deliberately not alerted — an always-on host has no "up too long" fault (ADR-0126).
Also trues up an inherited count
origin/mainhad 127 ADR files (ADR-0127 merged) but README still said "126 ADRs" — check_docs was red on main. This bumps it to 127 so the tree is consistent.Refs #1651.
Still to deploy (needs the lab and the firewall — not in this PR)
morpheuspass10.0.30.30 → 10.0.99.20:9090, metrics only.config.alloyships journal/auth/var logs to Loki, and the range host must not ship its logs.deploy-agent.shneeds a metrics-only mode. Do not deploy the standard agent togandalfbefore this exists.gandalfand convergeprometheus.Blast radius
Repo only; nothing deploys until the steps above run. New alerts begin evaluating
instance="gandalf"once the collector reports, after deploy.morpheuspass is documented, not applied)secrets/*.sops.yamlVerification
make validatepasses. Not run (no docker on this Mac). What ran:python3 scripts/check_docs.py:docs OK(172 Prometheus + 26 Loki rules).promtool test rulesonrange.test.yaml:SUCCESS;promtool check ruleson all files: valid.python3 scripts/check_rule_tests.py: every one of 210 alerts is selected by a test.collect-range-state.sh --self-test(11) andragnarok-stop.sh --self-test(29): pass.markdownlint-cli20.24.1:0 issues.shellcheck: clean../scripts/lint.sh: yamllint, ruff, shellcheck, actionlint pass; ansible-lint fails on the same local runner error as before (no Ansible here); markdownlint/zizmor/packer/tofu skipped (docker).🤖 Generated with Claude Code