feat: smart monitoring #25

Open
fauno wants to merge 5 commits from smartctl into main
Owner

it requires a helper script on the host because swarm doesn't support privileged mode

it requires a helper script on the host because swarm doesn't support privileged mode
fauno requested review from dannygroenewegen 2026-06-19 23:40:48 +00:00
ammaratef45 changed target branch from alloy to main 2026-09-02 22:57:41 +00:00
fauno added 3 commits 2026-09-11 09:49:32 +00:00
fauno force-pushed smartctl from 1581ae6430 to 48888a1fe9 2026-09-11 09:49:32 +00:00 Compare
Author
Owner

this is ready for review and it's been working in production!

this is ready for review and it's been working in production!
dannygroenewegen requested changes 2026-09-17 10:08:01 +00:00
Dismissed
dannygroenewegen left a comment
Owner

Don't have a physical host to test this with. But added some comments from reading the code.
And maybe add a short line to the next release notes.

Don't have a physical host to test this with. But added some comments from reading the code. And maybe add a short line to the next release notes.
@@ -0,0 +1,69 @@
#! /bin/bash
# Adapted from https://github.com/prometheus-community/smartctl_exporter/blob/master/collect-smartctl-json.sh
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Owner

script_dir is set, but never used?

`script_dir` is set, but never used?
Author
Owner

mmm i just made small tweaks to the script, do you think we need our own?

mmm i just made small tweaks to the script, do you think we need our own?
@@ -0,0 +57,4 @@
data="$($SUDO smartctl ${smartctl_args} ${device})"
# Accommodate a smartmontools pre-7.3 bug
data=${data#" Pending defect count:"}
type="$(echo "${data}" | "${json_tool}" "${json_args}" '.device.type')"
Owner

type, family and model are set with a json expression, but the variables are not used? Looks like only data is written to the json file?

`type`, `family` and `model` are set with a json expression, but the variables are not used? Looks like only `data` is written to the json file?
Author
Owner

idem

idem
Author
Owner

ok they were used but i removed the uses, i pushed the changes now!

ok they were used but i removed the uses, i pushed the changes now!
@@ -0,0 +4,4 @@
smartctl:
image: "prometheuscommunity/smartctl-exporter:v0.14.0"
volumes:
- "/dev:/dev"
Owner

If it's running with --smrtctl.fake-data, then I don't think it's needed to mount /dev ?

If it's running with `--smrtctl.fake-data`, then I don't think it's needed to mount `/dev` ?
fauno marked this conversation as resolved
fauno added 1 commit 2026-09-24 15:12:12 +00:00
fauno added 1 commit 2026-09-24 15:17:46 +00:00
fauno requested review from dannygroenewegen 2026-09-24 22:03:20 +00:00
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin smartctl:smartctl
git checkout smartctl
Sign in to join this conversation.