node exporter script for smartd
This commit is contained in:
1 parent
d5fb01adb2
commit
27d570fc5c
1 file changed
+17
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
OUT="/docker/monitoring/node_exporter/textfile_collector/smart_selftest.prom"
|
||||||
|
|
||||||
|
> "$OUT"
|
||||||
|
|
||||||
|
for dev in $(smartctl --scan-open | awk '{print $1}'); do
|
||||||
|
name=$(basename "$dev")
|
||||||
|
LAST=$(smartctl -l selftest "$dev" 2>/dev/null \
|
||||||
|
| grep "Completed" \
|
||||||
|
| head -1 \
|
||||||
|
| awk '{print $(NF-1)}')
|
||||||
|
|
||||||
|
echo $name: $LAST
|
||||||
|
# Skip devices without self-test history
|
||||||
|
echo "smart_last_selftest_poweron_hours{device=\"$name\"} $LAST" >> "$OUT"
|
||||||
|
done
|
||||||
Reference in new issue
Block a user