Repository navigation
fix(morpheus): alert when NUT loses the UPS and the syslog leaves' expiry; true up the audit's docs - #1671
Merged
Conversation
…piry; true up the audit's docs The repository side of the 2026-11-13 morpheus audit, apart from the firewall's own addresses and key-only sshd (#1503). - loki/rules/ups.rules.yaml: NutUpsDataStaleSustained (a stale period two minutes long) and NutUpsDataStaleFrequent (over twenty in an hour). The fortnight to 2026-11-23 had 1,363 periods, none over 5.2 s, at most nine an hour. Five behaviour tests. Neither sees a gap that lasts days, as the 2026-11-05 driver outage did, because syslogd folds repeats; so scripts/collect-nut-state.sh asks upsc on the firewall from make gateway-state, and NutUpsUnreadable pages after 30 minutes. - collect-cert-expiry.sh --file, for a client certificate with no handshake to read. make gateway-state reads the syslog listener's leaf and morpheus's pinned client leaf; SyslogTlsCertificateExpiringSoon warns at 30 days, and the console rules exclude syslog-*. - network.md: the undeclared Hicks SSH pass into smaug (ten passes), Skids' eighth reservation at .24, and the thirteen static ARP reservations. - hardware.md: check_versions.py does collect pfSense's release. - Changelog: the audit, and where each finding stood on 2026-11-23. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The alert logic can miss sustained outages after recent recoveries, while harmless diagnostics in successful UPS responses can cause false critical alerts.
2 open issues
What changed in this PR
This PR addresses monitoring and documentation findings from the morpheus audit, extending the existing observability stack while leaving firewall-access changes to #1503.
Changes:
- Adds NUT log alerts and periodic UPS-status collection.
- Adds syslog TLS certificate-expiry monitoring, including local certificate-file support.
- Corrects audit documentation and updates alert counts to 186.
| File | Description |
|---|---|
stacks/observability/README.md |
Updates Prometheus and Loki alert counts. |
stacks/observability/prometheus/tests/ups.test.yaml |
Tests unreadable and healthy NUT states. |
stacks/observability/prometheus/tests/cert-expiry.test.yaml |
Tests syslog expiry alerts and console-rule exclusions. |
stacks/observability/prometheus/rules/ups.rules.yaml |
Adds the critical NUT readability alert. |
stacks/observability/prometheus/rules/host.rules.yaml |
Separates syslog certificate alerts from console alerts. |
stacks/observability/loki/tests/ups.test.yaml |
Adds five NUT log-rule scenarios. |
stacks/observability/loki/rules/ups.rules.yaml |
Adds sustained and frequent stale-data alerts. |
scripts/self-tests.sh |
Documents the NUT collector’s self-test coverage. |
scripts/README.md |
Documents new collector capabilities. |
scripts/collect-nut-state.sh |
Collects UPS readability through SSH and upsc. |
scripts/collect-cert-expiry.sh |
Adds local certificate-file expiry collection. |
README.md |
Updates overall and per-engine alert counts. |
Makefile |
Adds syslog certificate and NUT collection to gateway-state. |
docs/security.md |
Updates the total alert count. |
docs/runbooks/generate-certificates.md |
Documents syslog certificate monitoring and renewal. |
docs/runbooks/deploy-stack.md |
Updates expected Prometheus rule counts. |
docs/observability.md |
Describes NUT monitoring and updates coverage counts. |
docs/network.md |
Records the SSH exception, reservations, and static ARP entries. |
docs/hardware.md |
Corrects the description of pfSense release collection. |
docs/changelog.md |
Records audit findings and their disposition. |
Review effort: Balanced
Gerrrt
enabled auto-merge (squash)
November 23, 2026 15:06
… review points main's #1673 added loki/rules/nut.rules.yaml, which covers a lasting loss (NutCommunicationsLost) and a driver down (NutDriverNotConnected). So NutUpsDataStaleSustained is dropped: it overlapped NutCommunicationsLost and its start-minus-end count across a sliding window could hide an open spell whose predecessor began before the window. NutUpsDataStaleFrequent moves into nut.rules.yaml, at > 24 an hour: the worst sliding hour to 2026-11-23 was 12, not the 9 an hour-aligned count gave. collect-nut-state.sh now finds the status line wherever upsc prints it, so a diagnostic such as "Init SSL without certificate database" before "OL" reads as readable, with two new fixtures. Counts: 192 rules, 166 Prometheus and 26 Loki; the Rules page lists 172. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 of 6 tasks
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 repository side of the 2026-11-13
morpheusaudit, apart from the two findings in #1503.NutUpsDataStaleFrequent, added to feat(observability): watch NUT's upsmon logs, so a disarmed shutdown pages #1673'sloki/rules/nut.rules.yaml, warns whenupsdmarks the data stale more than 24 times in an hour, twice the worst sliding hour measured (12). A spell that lasts is that file'sNutCommunicationsLost, so this PR's earlierNutUpsDataStaleSustainedis dropped. Two behaviour tests innut.test.yaml.upsmonorupsdline frommorpheusfor 2026-11-06, mid-way through the driver outage (docs(ups): record mjolnir's eight silent days, and fix §0.2's menu path #1656), and anupsdthat is down logs nothing. Newscripts/collect-nut-state.shasksupsc mjolnir@127.0.0.1 ups.statuson the firewall frommake gateway-state, andNutUpsUnreadable(critical) fires after 30 minutes without a status. A diagnosticupscprints before the status does not count against it. Self-test and promtool cases.collect-cert-expiry.shgains--file ENDPOINT=HOST=PATH, for a certificate that has no handshake to read (morpheus's client leaf; key files are refused).make gateway-statereadssyslog-listeneroff its handshake andsyslog-clientfrom the pinned copy.SyslogTlsCertificateExpiringSoonwarns at 30 days, and the two console rules now excludesyslog-*so their console-specific text never describes these. New promtool cases incert-expiry.test.yaml.network.md: the undeclared Hicks SSH pass intosmaugis declared (ten, not nine), Skids has eight reservations including.24, and a new note lists the thirteen reservationsmorpheuspins in its ARP table.hardware.md: no longer says nothing collects pfSense's release;check_versions.pydoes, fromsysDescr.Why
The audit found these, and on 2026-11-23 none had moved. Over the fortnight to 2026-11-23, NUT's data went stale 1,363 times, never longer than 5.2 s and never more than 12 in a sliding hour, and nothing watched it: a long gap during a power cut leaves every NUT secondary blind. The syslog leaves (825 days, due 2029-01-09) had no expiry alert; the day they lapse, the firewall's logs just stop. The doc fixes make
network.mdandhardware.mdtrue again.Blast radius
secrets/*.sops.yamlmake gateway-stategains two steps. One writescert-expiry-syslog-tls.promfrom the listener's handshake on 10.0.99.20:6514 and a public certificate file; if the listener is down it fails the job, andFirewallLogsStoppedwould be firing too. The other runsupscon morpheus over the ssh the job already makes, read-only.NutUpsUnreadableis critical, so it pages: today NUT readsOL, so it starts quiet. The new Loki rule is quiet against live Loki today (4 in the last hour).Verification
make validatepassed before the merge with main (5 local skips: worktree-only timer and unit checks and the tmpfs offsite refusal; CI runs them). After the merge: lint,check_docs.py, the Loki behaviour tests (65/65 over 26 rules),collect-nut-state.sh --self-testand promtool onups.test.yamlandcert-expiry.test.yamlpasscert-expiry-syslog-tls.promappears with both endpointschecked 1,nut-state-morpheus.promwithhomelab_nut_ups_readable 1, and thatNutUpsDataStaleFrequentis loaded on the Loki ruler.network.md,hardware.md,observability.md,generate-certificates.md,scripts/README.md, the changelog and the countsThe Loki expression was run against live Loki (4, under the threshold).
collect-cert-expiry.sh --printwith the new arguments reads both leaves (checked 1, 2029-01-09).collect-nut-state.sh --printagainst morpheus readsOL(readable 1).collect-nut-state.sh --self-test,collect-cert-expiry.sh --self-test, the Loki rule tests (65/65) andpromtool test rulesoncert-expiry.test.yamlandups.test.yamlpass.Refs #1503.
🤖 Generated with Claude Code