Skip to content

feat(trinity): collect SMART from trinity's own disks - #1597

Merged
Gerrrt merged 2 commits into
mainfrom
feat/trinity-smart-state
Nov 21, 2026
Merged

Gerrrt merged 2 commits into
mainfrom
feat/trinity-smart-state

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 21, 2026

Copy link
Copy Markdown
Owner

What changed

trinity gets a daily SMART read of its own disks: the boot NVMe that holds the sensitive tier, and the USB photo disk at /srv/immich. A new sensitive-profile timer, homelab-smart-state-sensitive (08:30, root), runs the existing collect-smart-state.sh through a new make target, smart-state-sensitive. It writes smart-state-trinity.prom, which the existing SmartDrive* rules and SmartStateStale already read for any host. The build runbook's step 4 now installs smartmontools, and step 12 says how to read the first run.

Why

The trinity audit of 2026-11-13 found that trinity was the one host with a checkout and Alloy that collected no SMART. A failing NVMe under the password vault, or a failing photo disk, would have shown first as I/O errors. The repo neither recorded nor decided this gap.

It is a new target, not make smart-state, because that target also renders smart-baselines.prom. SmartDriveBadSectors joins that file on(host, slot) from the single copy on the monitoring host, so a second copy from trinity would put two series on every key and break the join for every drive.

Blast radius

trinity only: one new root oneshot unit, no network (PrivateNetwork=true), with one writable path, the textfile directory. If smartmontools is missing, the job fails and ScheduledJobFailed pages. It does not report a clean run.

  • No change to network segmentation or firewall rules
  • No new port published to a VLAN that could not already reach the service
  • No credential added outside secrets/*.sops.yaml

Verification

  • python3 scripts/check_docs.py: docs OK.

  • ./scripts/install-timers.sh --check --profile sensitive: 0 FAIL. smart-state-sensitive: *-*-* 08:30:00 every 86400s, alerts at 172800s, the rendered units pass systemd-analyze verify, and no job name is declared by both profiles. Three off-host checks skip, as they do outside the deployment checkout.

  • ./scripts/lint.sh: passed. 4 tools were unavailable and skipped (yamllint, ruff ×2, ansible-lint), so CI is the run that covers them.

  • shellcheck on install-timers.sh: clean.

  • I did not run full make validate; CI does.

  • Not deployed yet. After merge, on trinity, run sudo apt-get install -y smartmontools, then make install-timers PROFILE=sensitive from the deployment checkout, then read the two files that step 12 names. Whether the USB bridges pass SMART through can only be seen on that first run.

  • make validate passes

  • Deployed to the lab and confirmed working

  • Docs updated (docs/, service README, or docs/roadmap.md)

🤖 Generated with Claude Code

trinity was the one Alloy host with a checkout that read no SMART. A new
sensitive-profile timer runs collect-smart-state.sh as root daily at 08:30,
through a new make target that skips the baseline table so the
SmartDriveBadSectors join keeps one copy. The build runbook installs
smartmontools.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 21, 2026 01:37
@Gerrrt
Gerrrt enabled auto-merge (squash) November 21, 2026 01:39

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 service cannot collect SMART data because ProtectSystem=strict makes its default lock directory read-only, causing both priming and timer runs to fail unless a writable lock directory is configured.

1 open issue
What changed in this PR

Adds daily SMART collection for trinity’s local disks using the existing collector and alert rules, without duplicating the monitoring host’s SMART baselines.

Changes:

  • Adds a root-run sensitive-profile service and persistent daily 08:30 timer.
  • Registers a collector-only Make target and scheduled job with a two-day freshness threshold.
  • Updates installation prerequisites, first-run checks, scheduling documentation, and the changelog.
File Description
systemd/​sensitive/​homelab-smart-state-sensitive.timer Schedules daily collection with missed-run recovery.
systemd/​sensitive/​homelab-smart-state-sensitive.service Runs the collector through the scheduled-job wrapper with sandboxing.
systemd/​README.md Lists the new sensitive-profile timer.
scripts/​install-timers.sh Registers and primes the SMART job.
Makefile Adds collection without rendering shared baselines.
docs/​runbooks/​schedule-maintenance.md Documents scheduling, freshness, and baseline isolation.
docs/​runbooks/​build-the-sensitive-tier-host.md Adds smartmontools and first-run verification steps.
docs/​changelog.md Records the new SMART collection setup.

Review effort: Balanced

ProtectSystem=strict leaves /run/lock read-only, and run-scheduled.sh opens
its lock there before running anything, so every run would have failed.
HOMELAB_LOCK_DIR points it at the textfile directory, the one writable path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit 19f6d4c into main Nov 21, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the feat/trinity-smart-state branch November 21, 2026 02:08
@Gerrrt
Gerrrt restored the feat/trinity-smart-state branch November 21, 2026 04:46
Gerrrt added a commit that referenced this pull request Nov 21, 2026
… lock dir (#1598)

The photo disk's Seagate enclosure (0bc2:ab18, uas) answers no ATA
pass-through, so the docs that promised a health row for it now say it has
none. The lock-directory commit merged with #1597 rested on a false claim
that /run/lock is read-only under ProtectSystem=strict; the monitoring host's
identically sandboxed unit locks there daily, so this unit goes back to it.

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