Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
From: with additional section for NVMe drives
System Temperatures - Tue Aug 13 13:18:16 CEST 2019
System Load: 0.15, 0.22, 0.20
CPU Temperature:
dev.cpu.1.temperature: 37.0C
dev.cpu.0.temperature: 37.0C
HDD Temperature:
ada0: 35 C - WDC WD40EFRX-68N32N0 (WD-WCC7K1VYRPJ3)
ada1: 34 C - ST4000VN008-2DR166 (ZDH6FF4Q)
NVMe Temperature:
nvme0: 35 C - Force MP300 (1921817900012436309D)
# 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/')) 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 }'`;
echo "NVMe Temperature:"
for i in $(ls /dev/nvme? | awk '{for (i=NF; i!=0 ; i--) print $i }' ) ; do
echo `echo $i | cut -c6-10`: `smartctl -a -n standby $i | awk '/Temperature:/{DevTemp=$2} /Serial Number:/{DevSerNum=$3}; /Model Number:/{ModelNumberA=$3; ModelNumberB=$4} END {printf "%s C - %s %s (%s)", DevTemp,ModelNumberA,ModelNumberB,DevSerNum }'`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.