Skip to content

Instantly share code, notes, and snippets.

@Raboo
Forked from fkleon/temperature.sh
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raboo/91e799d1290920f9c22c to your computer and use it in GitHub Desktop.
Save Raboo/91e799d1290920f9c22c to your computer and use it in GitHub Desktop.
FreeNAS 9 temperature script
#!/bin/sh
# Write some general information
echo System Temperatures - `date`
uptime | awk '{ print "\nSystem Load:",$10,$11,$12,"\n" }'
# Write CPU temperatures
echo "CPU Temperature:"
sysctl -a | egrep -E "cpu\.[0-9]+\.temp"
# Write HDD temperatures and status
echo "HDD Temperature:"
for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if(match($i, '/ada/')) print $i }' ) ; do
echo $i: `smartctl -a -n standby /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevVendor=$3; DevName=$4} END {printf "%s C - %s %s (%s)", DevTemp,DevVendor,DevName,DevSerNum }'`;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment