====== TrueNAS - Drives - List Temperature of Drives ======
Display the temperatures of the hard drives and your CPU Cores.
#!/bin/sh
### Parameters ###
cores=16
drives="da0 da1 da2 da3 da4 da5 da6 da7 da8 da9 da10 da11 da12 da12 da13 da14 da15 da16 da17 da18 da19 da20 da21 da22 da23 da24 da25 da26 da27 da28 da29 da30 da31 da32 da33 da34 da35 da36 da37 da38 da39 da40 da41 da42 da43 da44 da45 da46 da47 da48 da49 da50 da51 da52 da53 da54 da55 da56 da57 da58 da59"
### CPU ###
echo ""
cores=$((cores - 1))
for core in $(seq 0 $cores)
do
temp="$(sysctl -a | grep "cpu.${core}.temp" | cut -c24-25 | tr -d "\n")"
printf "CPU %s: %s C\n" "$core" "$temp"
done
### Disks ###
echo ""
for drive in $drives
do
serial="$(smartctl -i /dev/${drive} | grep "Serial Number" | awk '{print $3}')"
temp="$(smartctl -A /dev/${drive} | grep "Temperature_Celsius" | awk '{print $10}')"
printf "%s %-15s: %s C\n" "$drive" "$serial" "$temp"
done
echo ""s60#
**NOTE:** Adjust the number of your hard drives and the number of your cores.