FreeNAS CPU core and disk temperature check script
This is a nice simple script to display CPU core and disk temperatures on a FreeNAS server. Tested with FreeNAS 9.10.2-U1
Create a file with the following content - Mine is just called
temps_check_script.sh
as an example:# 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, '/da/')) printi }' ) ; 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
Ensure that the script is executable:
chmod +x temps_check_script.sh
Run it with
./temps_check_script.sh
- The output looks like this:System Temperatures - Wed Jun 21 07:53:16 AEST 2017 System Load: 0.17 CPU Temperature: dev.cpu.3.temperature: 40.0C dev.cpu.2.temperature: 44.0C dev.cpu.1.temperature: 40.0C dev.cpu.0.temperature: 42.0C HDD Temperature: ada0: 27 C - Hitachi HDS5C3020ALA632 (SERIALNUMBERGOESHERE) ada1: 27 C - Hitachi HDS5C3020ALA632 (SERIALNUMBERGOESHERE) ada2: 27 C - Hitachi HDS5C3020ALA632 (SERIALNUMBERGOESHERE) ada3: 28 C - Hitachi HDS5C3020ALA632 (SERIALNUMBERGOESHERE) ada4: 28 C - Hitachi HDS5C3020ALA632 (SERIALNUMBERGOESHERE) ada5: 27 C - Hitachi HDS5C3020ALA632 (SERIALNUMBERGOESHERE) da0: 32 C - TOSHIBA MD04ACA400 (SERIALNUMBERGOESHERE) da1: 31 C - TOSHIBA MD04ACA400 (SERIALNUMBERGOESHERE) da2: 29 C - TOSHIBA MD04ACA400 (SERIALNUMBERGOESHERE) da3: 30 C - TOSHIBA MD04ACA400 (SERIALNUMBERGOESHERE) da4: 31 C - TOSHIBA MD04ACA400 (SERIALNUMBERGOESHERE) da5: 30 C - TOSHIBA MD04ACA400 (SERIALNUMBERGOESHERE)