diff --git a/README.md b/README.md index 48484239..cd1ff9d7 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/docs/changelog.md b/docs/changelog.md index 23108f29..1a7856b5 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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 diff --git a/docs/hardware.md b/docs/hardware.md index ba0c0e30..7c0e3621 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -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 @@ -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 diff --git a/docs/observability.md b/docs/observability.md index 2390fbe3..5145ab45 100644 --- a/docs/observability.md +++ b/docs/observability.md @@ -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) @@ -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 | | --- | --- | @@ -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 diff --git a/docs/runbooks/deploy-stack.md b/docs/runbooks/deploy-stack.md index df7bc670..db7a3852 100644 --- a/docs/runbooks/deploy-stack.md +++ b/docs/runbooks/deploy-stack.md @@ -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 diff --git a/docs/runbooks/fit-the-ups-battery.md b/docs/runbooks/fit-the-ups-battery.md index 9675948f..732566f8 100644 --- a/docs/runbooks/fit-the-ups-battery.md +++ b/docs/runbooks/fit-the-ups-battery.md @@ -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 diff --git a/docs/security.md b/docs/security.md index a1887c39..38080d37 100644 --- a/docs/security.md +++ b/docs/security.md @@ -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 | diff --git a/stacks/observability/README.md b/stacks/observability/README.md index 15215a55..37cccaa6 100644 --- a/stacks/observability/README.md +++ b/stacks/observability/README.md @@ -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 diff --git a/stacks/observability/prometheus/rules/ups.rules.yaml b/stacks/observability/prometheus/rules/ups.rules.yaml index b6d4095d..3fb56a2c 100644 --- a/stacks/observability/prometheus/rules/ups.rules.yaml +++ b/stacks/observability/prometheus/rules/ups.rules.yaml @@ -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. diff --git a/stacks/observability/prometheus/tests/ups.test.yaml b/stacks/observability/prometheus/tests/ups.test.yaml index e2d9a872..a6200577 100644 --- a/stacks/observability/prometheus/tests/ups.test.yaml +++ b/stacks/observability/prometheus/tests/ups.test.yaml @@ -902,3 +902,121 @@ tests: The probe at the bottom of the rack has read over 30 °C for fifteen minutes. Check the room and the rack's airflow, then the DL360's inlet temperature on the iLO. A hot rack also ages the UPS pack. + + # --- UpsBatteryPackAging, UpsInputSensitivityChanged, UpsCardReadingMissing - + # + # promtool's clock starts at 1970-01-01, so year() is 1970 and month() is 1 + # here. A pack dated January 1967 is three years old and fires; one dated + # January 1968 is two and does not. The card's own reading, August 2026, is + # in the future at this clock and so far below three, which is the quiet case + # it really is today. + - interval: 1m + input_series: + - series: 'upsBasicBatteryLastReplaceDateYear{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "1967x120" + - series: 'upsBasicBatteryLastReplaceDateMonth{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "1x120" + - series: 'upsBasicBatteryLastReplaceDateYear{job="snmp",instance="10.0.99.11",device="spare"}' + values: "1968x120" + - series: 'upsBasicBatteryLastReplaceDateMonth{job="snmp",instance="10.0.99.11",device="spare"}' + values: "1x120" + - series: 'upsBasicBatteryLastReplaceDateYear{job="snmp",instance="10.0.99.12",device="today"}' + values: "2026x120" + - series: 'upsBasicBatteryLastReplaceDateMonth{job="snmp",instance="10.0.99.12",device="today"}' + values: "8x120" + alert_rule_test: + - eval_time: 30m + alertname: UpsBatteryPackAging + exp_alerts: [] + - eval_time: 90m + alertname: UpsBatteryPackAging + exp_alerts: + - exp_labels: + job: snmp + instance: 10.0.99.10 + device: mjolnir + component: power + severity: warning + category: power + exp_annotations: + runbook_url: "https://github.com/Gerrrt/HomeLab/blob/main/docs/runbooks/fit-the-ups-battery.md" + summary: "UPS mjolnir's battery pack is 3.0 years old" + description: >- + The card's Last Battery Replacement date is 3.0 + 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. + + # Sensitivity: high (4) fires after 30m; medium (3), the card today, does not. + - interval: 1m + input_series: + - series: 'upsAdvConfigSensitivity{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "4x60" + - series: 'upsAdvConfigSensitivity{job="snmp",instance="10.0.99.11",device="spare"}' + values: "3x60" + alert_rule_test: + - eval_time: 20m + alertname: UpsInputSensitivityChanged + exp_alerts: [] + - eval_time: 40m + alertname: UpsInputSensitivityChanged + exp_alerts: + - exp_labels: + job: snmp + instance: 10.0.99.10 + device: mjolnir + component: power + severity: warning + category: power + exp_annotations: + summary: "UPS mjolnir's input sensitivity is no longer medium" + description: >- + upsAdvConfigSensitivity reads 4 (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. + + # UpsCardReadingMissing: a card that answers with no battery date fires after + # an hour; with all three readings it does not. + - interval: 1m + input_series: + - series: 'up{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "1x90" + - series: 'upsAdvConfigSensitivity{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "3x90" + alert_rule_test: + - eval_time: 90m + alertname: UpsCardReadingMissing + exp_alerts: + - exp_labels: + job: snmp + instance: 10.0.99.10 + device: mjolnir + component: power + severity: warning + category: power + exp_annotations: + summary: "mjolnir 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. + + - interval: 1m + input_series: + - series: 'up{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "1x90" + - series: 'upsAdvConfigSensitivity{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "3x90" + - series: 'upsBasicBatteryLastReplaceDateYear{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "2026x90" + - series: 'upsBasicBatteryLastReplaceDateMonth{job="snmp",instance="10.0.99.10",device="mjolnir"}' + values: "8x90" + alert_rule_test: + - eval_time: 90m + alertname: UpsCardReadingMissing + exp_alerts: [] diff --git a/stacks/observability/snmp-exporter/generator.yaml b/stacks/observability/snmp-exporter/generator.yaml index 11af50d1..866f1076 100644 --- a/stacks/observability/snmp-exporter/generator.yaml +++ b/stacks/observability/snmp-exporter/generator.yaml @@ -145,10 +145,34 @@ modules: # back empty while the card answers, which is how a wrong guess about # which table the card uses would show itself. - 1.3.6.1.4.1.318.1.1.25.1.2 # PowerNet-MIB::uioSensorStatusTable + # Two scalars nothing else carries, for UpsBatteryPackAging and + # UpsInputSensitivityChanged (2026-11-24). Both were read off the card + # first with scripts/snmp-walk.sh, one row each: + # + # .2.1.3.0 upsBasicBatteryLastReplaceDate "08/15/2026" + # .5.2.7.0 upsAdvConfigSensitivity 3 medium + # + # The date is the card's *Last Battery Replacement*, which stores a month + # and year only; the 15 is a filler day. It is the only record of the + # pack's age, so the regex below turns it into two numbers a rule can do + # arithmetic on. Sensitivity runs auto(1), low(2), medium(3), high(4); + # medium since 2026-11-24, after three distorted-input transfers in a + # month at high. The generator turns each scalar into a GET of its .0, + # so neither adds a walk. + - 1.3.6.1.4.1.318.1.1.1.2.1.3 # PowerNet-MIB::upsBasicBatteryLastReplaceDate + - 1.3.6.1.4.1.318.1.1.1.5.2.7 # PowerNet-MIB::upsAdvConfigSensitivity lookups: - source_indexes: [uioSensorStatusPortID, uioSensorStatusSensorID] lookup: uioSensorStatusSensorName overrides: + upsBasicBatteryLastReplaceDate: + regex_extracts: + Year: + - regex: '^\d{2}/\d{2}/(\d{4})$' + value: '$1' + Month: + - regex: '^(\d{2})/\d{2}/\d{4}$' + value: '$1' # The two index columns repeat the labels every row already carries. uioSensorStatusPortID: ignore: true diff --git a/stacks/observability/snmp-exporter/snmp.yaml b/stacks/observability/snmp-exporter/snmp.yaml index 004fda97..c8d32193 100644 --- a/stacks/observability/snmp-exporter/snmp.yaml +++ b/stacks/observability/snmp-exporter/snmp.yaml @@ -36,6 +36,9 @@ modules: - 1.3.6.1.2.1.33.1 - 1.3.6.1.4.1.318.1.1.1.7.2 - 1.3.6.1.4.1.318.1.1.25.1.2 + get: + - 1.3.6.1.4.1.318.1.1.1.2.1.3.0 + - 1.3.6.1.4.1.318.1.1.1.5.2.7.0 metrics: - name: upsIdentManufacturer oid: 1.3.6.1.2.1.33.1.1.1 @@ -386,6 +389,28 @@ modules: type: gauge help: The maximum line voltage allowed before the UPS system transfers to battery backup. - 1.3.6.1.2.1.33.1.9.10 + - name: upsBasicBatteryLastReplaceDate + oid: 1.3.6.1.4.1.318.1.1.1.2.1.3 + type: DisplayString + help: The date when the UPS system's batteries were last replaced in mm/dd/yy + (or yyyy) format - 1.3.6.1.4.1.318.1.1.1.2.1.3 + regex_extracts: + Month: + - value: $1 + regex: ^(?:^(\d{2})/\d{2}/\d{4}$)$ + Year: + - value: $1 + regex: ^(?:^\d{2}/\d{2}/(\d{4})$)$ + - name: upsAdvConfigSensitivity + oid: 1.3.6.1.4.1.318.1.1.1.5.2.7 + type: gauge + help: The sensitivity of the UPS to utility line abnormalities or noises. - + 1.3.6.1.4.1.318.1.1.1.5.2.7 + enum_values: + 1: auto + 2: low + 3: medium + 4: high - name: upsAdvTestDiagnosticSchedule oid: 1.3.6.1.4.1.318.1.1.1.7.2.1 type: gauge