Repository navigation
feat(trinity): collect SMART from trinity's own disks #1597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # SMART health for trinity's own disks: the boot NVMe that holds the tier, and | ||
| # the USB disk at /srv/immich that holds the photographs (ADR-0064). | ||
| # | ||
| # The monitoring host's homelab-smart-state.service, run on the other host with | ||
| # a checkout, and that unit explains every directive below; this one states | ||
| # only what differs. Before it, trinity was the one Alloy host with a checkout | ||
| # that read no SMART at all: a failing NVMe under the password vault would have | ||
| # said so first as I/O errors. | ||
| # | ||
| # NOT `make smart-state`. That target also renders smart-baselines.prom, and | ||
| # SmartDriveBadSectors joins it `on(host, slot)` from the one copy the | ||
| # monitoring host serves (scripts/render-smart-baselines.sh). A second copy | ||
| # from here would put two series on every key and break the join for the whole | ||
| # estate. `make smart-state-sensitive` runs the collector alone. | ||
| # | ||
| # ROOT, for the estate unit's reason: smartctl's ATA and NVMe pass-through | ||
| # ioctls need raw device access, and no group substitutes. Nothing here runs as | ||
| # @RUN_USER@, so the unit reads that user's checkout and writes one directory. | ||
| # | ||
| # ITS LOCK LIVES IN THE TEXTFILE DIRECTORY. run-scheduled.sh opens | ||
| # ${HOMELAB_LOCK_DIR:-/run/lock}/homelab-<job>.lock before it runs anything, and | ||
| # ProtectSystem=strict leaves every path read-only but /dev, /proc, /sys and | ||
| # the ReadWritePaths below, /run/lock included. This job shares no lock with | ||
| # any other, so its own lock file can sit in the one directory it may write; | ||
| # node_exporter reads only *.prom there. Narrower than opening /run/lock, which | ||
| # holds other programs' locks. | ||
| # | ||
| # THE HOUSEHOLD DRIVE IS READ WHILE IT IS PLUGGED IN, and that is fine. It is | ||
| # attached here between copies (ADR-0073) and leaves with the holder; its | ||
| # series stop when it does, and no rule reads a drive's absence. | ||
| [Unit] | ||
| Description=HomeLab: collect SMART health for trinity's disks | ||
| Documentation=file://@DEPLOY_ROOT@/docs/runbooks/schedule-maintenance.md | ||
|
|
||
| [Service] | ||
| Type=oneshot | ||
| User=root | ||
| Group=root | ||
| WorkingDirectory=@DEPLOY_ROOT@ | ||
| EnvironmentFile=-/etc/default/homelab-timers | ||
| Environment=HOMELAB_LOCK_DIR=/var/lib/node_exporter/textfile_collector | ||
| ExecStart=@DEPLOY_ROOT@/scripts/run-scheduled.sh --job smart-state-sensitive -- /usr/bin/make -C @DEPLOY_ROOT@ smart-state-sensitive | ||
| TimeoutStartSec=300 | ||
| Restart=no | ||
| Nice=10 | ||
| NoNewPrivileges=true | ||
| RestrictSUIDSGID=true | ||
| LockPersonality=true | ||
| RestrictRealtime=true | ||
| PrivateTmp=true | ||
| ProtectHome=read-only | ||
| ProtectSystem=strict | ||
| ReadWritePaths=/var/lib/node_exporter/textfile_collector | ||
| ProtectKernelTunables=true | ||
| ProtectKernelModules=true | ||
| ProtectControlGroups=true | ||
| PrivateNetwork=true | ||
| StandardOutput=journal | ||
| StandardError=journal | ||
| SyslogIdentifier=homelab-smart-state-sensitive | ||
|
|
||
| # No [Install] section: the timer enables this. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [Unit] | ||
| Description=HomeLab: daily SMART collection on trinity | ||
| Documentation=file://@DEPLOY_ROOT@/docs/runbooks/schedule-maintenance.md | ||
|
|
||
| [Timer] | ||
| Unit=homelab-smart-state-sensitive.service | ||
| # 08:30, the estate's SMART time, so "every host's SMART is from this morning" | ||
| # stays true. Clear of the night's backups and their verification, which are | ||
| # done by 06:30 and hold the `backups` lock this does not take. | ||
| OnCalendar=*-*-* 08:30:00 | ||
| RandomizedDelaySec=900 | ||
| # True: a missed morning is collected at the next boot, so a gap in the series | ||
| # means "stopped reporting" and not "was off at 08:30". | ||
| Persistent=true | ||
| AccuracySec=1m | ||
|
|
||
| [Install] | ||
| WantedBy=timers.target |
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.
Uh oh!
There was an error while loading. Please reload this page.