#!/bin/bash for device in $(smartctl --scan | cut -d' ' -f1) do # POWER STATUS if $(smartctl -n idle -n sleep -i $device | grep "Power mode" | grep -q "STANDBY") then active=False else active=True fi echo "smartctl,host=${node.name},device=$device active=$active $(date --utc +%s%N)" # TEMPS temp=$(smartctl -n idle -A --json=c $device | jq .temperature.current) if [[ $temp == ?(-)+([0-9]) ]] then echo "smartctl,host=${node.name},device=$device temperature=<%text>${temp}i $(date --utc +%s%N)" elif [[ $temp == null ]] then # hdd might be sleeping continue else # hdd might be unsupported continue fi done