Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ documents for different readers.
can't run an agent (firewall, switch, UPS, iLO). One agent config, deployed
identically everywhere. [How](docs/architecture.md#observability-data-flow)
- **Dashboards and alerting as code.** 8 provisioned dashboards, 156 panels, and
203 alert rules — 175 metric-based in Prometheus, 28 log-based in Loki — sharing
206 alert rules — 178 metric-based in Prometheus, 28 log-based in Loki — sharing
one Alertmanager routing tree. No dashboard exists only in a database.
- **Secrets encrypted in-repo with SOPS + age.** Per-device credentials,
decrypted at deploy time into gitignored paths, with `git log` showing which
Expand Down Expand Up @@ -207,7 +207,7 @@ inbound passes may still reach it. Data flow and the maintained Mermaid topology
.
├── stacks/
│ ├── observability/ # the estate's stack on prometheus — ten services
│ │ ├── prometheus/ # config, file_sd targets, 175 alert rules
│ │ ├── prometheus/ # config, file_sd targets, 178 alert rules
│ │ ├── alertmanager/ # routing and inhibition
│ │ ├── loki/ # single-binary config + 28 LogQL rules
│ │ ├── alloy/ # the agent config directory, shipped to every host
Expand Down
19 changes: 19 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ docstring gives: it is a record, not a claim about now.
were removed and verified gone, with nothing on the host or in the repo using
or re-provisioning the key, so the host now matches §4's *Nothing else on
`gandalf`*.

- **Two `mjolnir` settings are now read and watched.** The 2026-11-13 audit
found nothing would notice either one changing.
- **The pack's age.** `generator.yaml` now reads the card's *Last Battery
Replacement* (`upsBasicBatteryLastReplaceDate`). That field holds a month
and year, and the generator's regex splits it into `...Year` and
`...Month`. `UpsBatteryPackAging` warns at three years, the bottom of
APC's three-to-five-year rating for the APCRBC115. The pack fitted in
August 2026 reaches that in August 2029.
- **Input sensitivity.** `upsAdvConfigSensitivity` is read too, and
`UpsInputSensitivityChanged` warns if it leaves medium for 30 minutes. A
card reset would put it back to high without a word.
- **A guard.** `UpsCardReadingMissing` warns when the card answers but
either reading is absent. A date in a format the regex doesn't match
would otherwise keep both rules quiet for ever.
- Both OIDs were read off the card with `snmp-walk.sh` before the
generator was changed. `snmp.yaml` gains the two GETs, and `ups.test.yaml`
gives each rule a firing case and a quiet one. The alert rules now
number 206: 178 in Prometheus and 28 in Loki.
- **`UpsOnBattery` now pages on a short transfer.** On 2026-11-21 the UPS
ran on battery for 82 seconds, for distorted input, and nothing paged. The
rule was `upsSecondsOnBattery > 0` for 30 seconds, which needs two scrapes in
Expand Down
7 changes: 5 additions & 2 deletions docs/hardware.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ UPS with its output on. [`update-the-ups-firmware.md`](runbooks/update-the-ups-f
is the procedure for both, tracked in
[#1698](https://github.com/Gerrrt/HomeLab/issues/1698). The card answers HTTPS and SSH; its HTTP port is closed.
SSH stays on by the owner's decision of 2026-11-23. **Input sensitivity is
medium**, lowered from high by 2026-11-24. The card's event log gives the
medium**, lowered from high by 2026-11-24, and `UpsInputSensitivityChanged`
warns if a card reset or anyone else moves it. The card's event log gives the
reason. It shows three transfers to battery since 2026-10-29, and the UPS
gave the same cause for all three: distorted input, not a cut. They lasted
279 seconds on 2026-10-29, 1 second on 2026-11-07 and 82 seconds on
Expand Down Expand Up @@ -407,7 +408,9 @@ the runbook rather than backed up.
the card ([#93](https://github.com/Gerrrt/HomeLab/issues/93)). The card's
*Last Battery Replacement* takes a month and year only. It holds August
2026, the month the pack went in, and is the only record of the pack's age.
SNMP and NUT show it with a filler day, as `08/15/2026`
SNMP and NUT show it with a filler day, as `08/15/2026`. Prometheus reads it,
and `UpsBatteryPackAging` warns when the pack reaches three years, in August
2029. APC rates the pack at three to five years
- APC AP9335T temperature probe on the UPS card's universal I/O port, for rack
ambient at the bottom of the rack. Bought and plugged in by 2026-11-23, read
over the card's SNMP from then
Expand Down
6 changes: 3 additions & 3 deletions docs/observability.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ separates a quiet stream from a stopped one.

## Alerting

203 rules in total: 175 metric-based in `prometheus/rules/`, and 28 log-based in
206 rules in total: 178 metric-based in `prometheus/rules/`, and 28 log-based in
`loki/rules/`.

### Log-based (Loki ruler)
Expand Down Expand Up @@ -550,7 +550,7 @@ argument and for what to do when it exits 1.

### Metric-based (Prometheus)

175 rules across 13 files in `prometheus/rules/`:
178 rules across 13 files in `prometheus/rules/`:

| File | Covers |
| --- | --- |
Expand Down Expand Up @@ -587,7 +587,7 @@ as loaded and healthy and could not fire for any input ([#63](https://github.com
`prometheus/tests/*.test.yaml` holds `promtool test rules` unit tests, which
feed a rule synthetic series and assert it fires — paired with a case asserting
it stays quiet, because a test that only ever expects silence would have passed
against the broken rule too. Coverage is 175 rules of 175 so far ([#843](https://github.com/Gerrrt/HomeLab/issues/843)) — all twelve
against the broken rule too. Coverage is 178 rules of 178 so far ([#843](https://github.com/Gerrrt/HomeLab/issues/843)) — all twelve
in `blackbox.rules.yaml`, all three in `dns.rules.yaml`, all seven in `range.rules.yaml`, `GatewayFilesystemCritical`, `ContainerHighMemory`,
`ContainerNearMemoryLimit`, `ContainerRestartLoop`, `ContainerCpuThrottled`,
the three container-state rules from
Expand Down
2 changes: 1 addition & 1 deletion docs/runbooks/deploy-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Then in the UI:
1. **Prometheus → Status → Targets.** Every job `UP`. The four `snmp` targets
take up to 45 seconds on their first scrape.
2. **Prometheus → Status → Rules.** Every rule loaded, none in error. The
page lists 181: the 175 alert rules this repository counts everywhere
page lists 184: the 178 alert rules this repository counts everywhere
else, plus the six recording rules:
`homelab_suricata_expected_interface`,
`homelab_battery_runtime_seconds`, and the two directions each of
Expand Down
3 changes: 2 additions & 1 deletion docs/runbooks/fit-the-ups-battery.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ the cases that genuinely need the wire, and reads the credential from SOPS.
[#404](https://github.com/Gerrrt/HomeLab/issues/404) decides where it lives.
5. **Fit the APCRBC115 pack** last, per the Smart-UPS front-bezel procedure,
then set *Configuration → UPS → Last Battery Replacement* to the month and
year of the fit. The field takes no day.
year of the fit. The field takes no day. It is what `UpsBatteryPackAging`
counts three years from, so setting it is what clears that warning.

## 3. Delete the silence — immediately, not on expiry

Expand Down
2 changes: 1 addition & 1 deletion docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ What this network is actually built to survive:
| Someone on Winterfell or Hicks logging in to `trinity` | **Key-only `sshd` since 2026-11-20; no host firewall by decision.** `trinity` holds the household's data and the sensitive tier's age key, and its `sshd` answers Hicks (by [ADR-0031](adr/0031-narrow-hicks-to-a-named-list-on-winterfell-and-leave-the-lab-open.md)'s list) and every host on VLAN 99, between which pfSense never filters. [`build-the-sensitive-tier-host.md`](runbooks/build-the-sensitive-tier-host.md) §3 now makes `sshd` key-only through a drop-in that outranks cloud-init's, refuses root and X11 forwarding, and keeps `authorized_keys` to `prometheus`'s key and Hicks's. The audit of 2026-11-13 found it taking passwords, with X11 forwarding on and 17 keys imported from GitHub. The step was applied on 2026-11-20: a password-only login is refused with `Permission denied (publickey)`, and three keys remain, `prometheus`'s, Hicks's and the operator's laptop, the last kept by decision. Agent sessions run on `trinity` as the operator, by decision ([ADR-0123](adr/0123-keep-agent-sessions-on-trinity.md)). `ufw` is installed and stays disabled, unlike `phoenix`'s ([ADR-0117](adr/0117-give-phoenix-a-key-only-sshd-and-a-default-deny-inbound-policy.md)): the other two ports `trinity` answers, `443` and `53`, are published by Docker, whose rules run ahead of `ufw`'s, so a policy would govern `22` alone, which the drop-in already closes to anything without a key. Nothing routes through `trinity`, and as the spare firewall a host policy is one more thing to get in the way the day it stands in for `morpheus`. What reaches `443` and `53` is set by pfSense and by the stack's bind addresses |
| Someone on Winterfell or Hicks logging in to `prometheus` | **Key-only `sshd` since 2026-11-23; no host firewall by decision.** `prometheus` holds the estate's CA key and the age key that opens every volume backup set, and converge runs as the operator, who is in `sudo` and `docker`. Its `sshd` answers all of Hicks (by `morpheus`'s pass for `22` to the segment) and every host on VLAN 99. The audit's root-only reads on 2026-11-23 found it taking passwords, with X11 forwarding on and `ufw` inactive. [ADR-0128](adr/0128-give-prometheus-a-key-only-sshd-and-no-host-firewall.md) makes `sshd` key-only through a drop-in that outranks cloud-init's, refusing root and X11 forwarding ([`restore-the-stack.md`](runbooks/restore-the-stack.md#make-sshd-key-only)). It adds no host firewall, because Docker's rules run ahead of `ufw`'s for the published ports, so a policy would cover `22` alone. Those ports stay fenced as before: by `morpheus` by destination, by the ingest proxy's tokens on `9090` and `3100`, and on `6514` by the syslog listener's pinned client certificate and its sender list. The step was applied the same day. `sshd -T` read `no` for all four settings, a password login and a keyboard-interactive login were each refused with `Permission denied (publickey)`, and a key login from Hicks succeeded after the reload. |
| Someone with the trusted Wi-Fi key quietly joining | Kea's lease log reaches Loki; `UnknownDeviceOnTrustedSegment` fires the first time a MAC appears on VLAN 50 in seven days ([ADR-0019](adr/0019-read-device-joins-from-the-dhcp-server.md)) |
| Losing visibility of a failure | 203 alert rules, 30 days of metrics and logs |
| Losing visibility of a failure | 206 alert rules, 30 days of metrics and logs |
| Someone on a reachable VLAN silencing an alert to hide a failure | Alertmanager binds to `127.0.0.1`; silences go through authenticated Grafana |
| Mains power loss | **The rack, yes; the monitoring path, yes — on two laptop cells that were measured for the first time on 2026-09-12.** A pack fitted to `mjolnir` on 2026-08-28 passed its self-test; the TP-Link carrying `prometheus` and `oracle` has been on UPS power since 2026-09-08 ([#110](https://github.com/Gerrrt/HomeLab/issues/110)); the laptops ride a cut out on their own batteries, which `HostBatteryHealthLow` in `host.rules.yaml` now reads — `prometheus`'s cell was replaced on 2026-09-18 and reads 101 % of design, `oracle`'s was replaced on 2026-09-29 and reads 100 %, its design figure rather than a learned one ([#531](https://github.com/Gerrrt/HomeLab/issues/531)) — and **each runtime was measured once: `prometheus`'s on 2026-09-19, about 2.5 hours from full at the stack's load, and `oracle`'s on 2026-09-29, about 5.2 hours**; since the same day the projection is recorded on every cut and pages under thirty minutes (`HostBatteryRuntimeLow`, [#532](https://github.com/Gerrrt/HomeLab/issues/532)), but neither pack reports a moving cell temperature, so this row is answered for both hosts' runtime and for neither's cell temperature — see below. **What happens when the cut outlasts the pack is configured and accepted without a live test.** Since 2026-09-23 the firewall's NUT server reads `mjolnir`, and `Saruman` and `smaug` subscribe to it on their own gateway addresses, so a real cut would now try to run the sequence [ADR-0049](adr/0049-shut-down-on-the-ups-from-a-nut-server-on-the-firewall.md) decides: `Saruman` and `smaug` halt first and `morpheus` last. Since the move into the 32U rack on 2026-11-06 the PDU also carries `trinity`, `gandalf` (off until its build) and the console, with `smaug` racked and on the PDU directly rather than by its old long cord to the media room. [ADR-0107](adr/0107-subscribe-trinity-to-the-ups-and-bound-saruman-s-guest-stop.md) makes `trinity` a third subscriber and bounds `Saruman`'s guest stop. `Saruman`'s half was applied on 2026-11-13 (`down=90` on the four ordered guests, and its monitor stays logged in until they are down); `trinity`'s subscription, `HOSTSYNC 600` on `morpheus` and the card's 16-minute threshold followed on 2026-11-20, so all three subscribers would now halt before the pack empties; `gandalf`, the console and `neo` are left to the pack by decision. The pack itself is unmeasured: about 47 minutes at 21 % load is the card's own estimate. Neither the forced-shutdown proof nor a mains pull will be run ([ADR-0121](adr/0121-accept-the-ups-shutdown-without-a-live-test.md)) |
| The estate being down while the person who runs it is unavailable | **Documentation, yes; data, no copy outside the house, by decision.** ADR-0011 puts the emergency tier on paper; [ADR-0023](adr/0023-keep-the-household-recovery-path-outside-the-estate.md) extends the same reasoning to the sensitive tier's data. That tier has held real photographs since 2026-09-28. [ADR-0122](adr/0122-drop-the-household-copy.md) dropped their copy outside the estate, so a loss of the house loses them — see below |
Expand Down
2 changes: 1 addition & 1 deletion stacks/observability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ prometheus/
targets/snmp.yaml SNMP targets — hot-reloaded, no restart needed
targets/node.yaml node_exporter scrapes, for the host that runs no Alloy (smaug)
targets/blackbox*.yaml probe targets, http, dns and latency — hot-reloaded, no restart
rules/*.rules.yaml 175 alert rules: host, network, ups, containers, blackbox,
rules/*.rules.yaml 178 alert rules: host, network, ups, containers, blackbox,
dns, backup, ids, deploy, stack, internet, watchdog and range
tests/*.test.yaml promtool unit tests — assert the rules can fire
blackbox/blackbox.yaml probe modules — reachability, and what a resolver said
Expand Down
83 changes: 83 additions & 0 deletions stacks/observability/prometheus/rules/ups.rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,86 @@ groups:
minutes, past the DL360's rated inlet limit. Cool the
room or open the rack now; if it keeps climbing, shut down the
heaviest load (Saruman) before its own thermal trip does.

# --- Two card settings no other rule reads (2026-11-24) ----------------
#
# Both came out of the 2026-11-13 audit of mjolnir. generator.yaml has
# the OIDs and what the card answered. Neither is an outage, so both are
# warnings, and UpsCardReadingMissing is the check that they are read at
# all: a rule over a series that never arrives stays quiet for ever.

- alert: UpsBatteryPackAging
# Pack age in years, to the month: the card's *Last Battery
# Replacement* holds a month and year only, and generator.yaml's regex
# splits it into ...Year and ...Month. APC rates the APCRBC115 at three
# to five years, so three is when to plan a pack, not when it fails:
# UpsSelfTestFailed and UpsRideThroughShort say that. The pack fitted
# in August 2026 reaches three in August 2029.
#
# scalar(): year() and month() return a series with no labels, which
# would match nothing on the card's side of the subtraction.
expr: |
(scalar(year()) + (scalar(month()) - 1) / 12)
- (upsBasicBatteryLastReplaceDateYear + (upsBasicBatteryLastReplaceDateMonth - 1) / 12)
>= 3
for: 1h
labels:
component: power
severity: warning
category: power
annotations:
runbook_url: "https://github.com/Gerrrt/HomeLab/blob/main/docs/runbooks/fit-the-ups-battery.md"
summary: "UPS {{ $labels.device }}'s battery pack is {{ $value | printf \"%.1f\" }} years old"
description: >-
The card's Last Battery Replacement date is {{ $value | printf "%.1f" }}
years ago, and APC rates the pack at three to five. Order an
APCRBC115 and fit it with fit-the-ups-battery.md, which ends by
setting Last Battery Replacement to the month of the fit; that is
what clears this.

- alert: UpsInputSensitivityChanged
# upsAdvConfigSensitivity: auto(1), low(2), medium(3), high(4). Medium
# since 2026-11-24: at high the UPS went to battery three times in a
# month for distorted input, not a cut. A card reset puts it back to
# its default without a word, and no other rule would notice.
expr: upsAdvConfigSensitivity != 3
for: 30m
labels:
component: power
severity: warning
category: power
annotations:
summary: "UPS {{ $labels.device }}'s input sensitivity is no longer medium"
description: >-
upsAdvConfigSensitivity reads {{ $value }} (1 auto, 2 low, 4 high);
it was set to medium (3) on 2026-11-24. Set it back under
Configuration → Power Settings on the card, or, if the change was
deliberate, change this rule and hardware.md with it.

- alert: UpsCardReadingMissing
# The card answers but either reading above is absent: the battery
# date in a shape the regex does not take (PowerNet allows mm/dd/yy,
# which a card reset may bring back), or a firmware that drops an OID.
# Without this, UpsBatteryPackAging and UpsInputSensitivityChanged
# would both stay quiet for ever.
expr: |
up{job="snmp", device="mjolnir"} == 1
unless on(device) (
upsBasicBatteryLastReplaceDateYear
and on(device) upsBasicBatteryLastReplaceDateMonth
and on(device) upsAdvConfigSensitivity
)
for: 1h
labels:
component: power
severity: warning
category: power
annotations:
summary: "{{ $labels.device }} answers SNMP but its battery date or sensitivity is unread"
description: >-
One of upsBasicBatteryLastReplaceDateYear, ...Month or
upsAdvConfigSensitivity is missing, so the pack-age and sensitivity
alerts cannot fire. Read each from the repository checkout with
`scripts/snmp-walk.sh --device mjolnir 1.3.6.1.4.1.318.1.1.1.2.1.3`
and `scripts/snmp-walk.sh --device mjolnir 1.3.6.1.4.1.318.1.1.1.5.2.7`,
and compare the date's format with the regex in generator.yaml.
Loading