smartctl
main
it requires a helper script on the host because swarm doesn't support privileged mode
1581ae6430
48888a1fe9
this is ready for review and it's been working in production!
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 )
script_dir is set, but never used?
script_dir
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')"
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
model
data
idem
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"
If it's running with --smrtctl.fake-data, then I don't think it's needed to mount /dev ?
--smrtctl.fake-data
/dev
No dependencies set.
The note is not visible to the blocked user.
it requires a helper script on the host because swarm doesn't support privileged mode
1581ae6430to48888a1fe9this is ready for review and it's been working in production!
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.shscript_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )script_diris set, but never used?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 bugdata=${data#" Pending defect count:"}type="$(echo "${data}" | "${json_tool}" "${json_args}" '.device.type')"type,familyandmodelare set with a json expression, but the variables are not used? Looks like onlydatais written to the json file?idem
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"If it's running with
--smrtctl.fake-data, then I don't think it's needed to mount/dev?View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.