Commit 1d22175e authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Merge branch 'smart_fix' into 'master'

Fix smart data collection

See merge request !523
parents a0526102 917ef350
Pipeline #15006 passed with stage
in 45 seconds
......@@ -44,12 +44,23 @@ for ((i=0; i < $devices_total; i++)); do
echo "smart_device_smart_healthy{disk=\"${disk}\"} 0" >> $TMP_FILE
fi
# NVME ssd's don't have an ata_smart_data table
if [[ "$info" == *"\"ata_smart_data\":"* ]]; then
progress=$(echo $info | jq '.ata_smart_data.self_test.status.string')
# When a self test in progress, smartctl omits the status key which is a bug in smartctl but we'll work around it.
if [[ "$progress" == *"in progress"* ]]; then
echo "smart_device_self_test{disk=\"${disk}\"} 1" >> $TMP_FILE
else
status=$(echo $info | jq '.ata_smart_data.self_test.status.passed')
if [[ "$status" == "true" ]]; then
echo "smart_device_self_test{disk=\"${disk}\"} 1" >> $TMP_FILE
else
echo "smart_device_self_test{disk=\"${disk}\"} 0" >> $TMP_FILE
fi
fi
else
echo "smart_device_self_test{disk=\"${disk}\"} 1" >> $TMP_FILE
fi
echo "smart_temperature_celsius{disk=\"${disk}\"} $(echo $info | jq '.temperature.current')" >> $TMP_FILE
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment