Last active
January 10, 2026 15:57
-
-
Save Hermann-SW/0c3690624375295ddfac919295169222 to your computer and use it in GitHub Desktop.
Determine temerature statistics for sockets and cores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| nsockets=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) | |
| for((i=0; i<nsockets; ++i)) | |
| do | |
| coretemp=$(sensors -A | sed -n "/^coretemp-isa-000$i/,/^$/p") | |
| echo "$coretemp" | grep "Package" | sort | |
| high=$(echo "$coretemp" | grep "Core" | cut -b17- | grep high | sort -n) | |
| ts=$( | |
| ( | |
| echo "$high" | sort -n | head -1 | |
| echo "$high" | sort -n | \ | |
| awk '{ total += $1; count++ } END { printf("%.2f°C\n", total/count) }' | |
| echo "$high" | sort -n | tail -1 | |
| ) | ( cut -f1 -d\ ) | |
| ) | |
| echo -n $ts # double quoting as shellcheck suggests would break formatting | |
| echo -e "\t(min/avg/max of $(echo "$coretemp" | grep -c "Core")"" cores)" | |
| done |
Author
Author
Script does not work on single socket machines.
Just installed lm-sensors on another 2-socket server:
https://www.cyberciti.biz/faq/install-sensors-lm-sensors-on-ubuntu-debian-linux/
coretemps just works, temperatures and correct core count per package:
hermann@E5-2680v4:~$ coretemps
Package id 0: +42.0°C (high = +90.0°C, crit = +100.0°C)
35.0°C 35.79°C 38.0°C (min/avg/max of 14 cores)
Package id 1: +39.0°C (high = +90.0°C, crit = +100.0°C)
33.0°C 34.29°C 35.0°C (min/avg/max of 14 cores)
hermann@E5-2680v4:~$
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample output for 192C/384T 8-socket server running
numactl -C 0-191 gp -q...... for 4d+13h / 192 = 34min:
(packages 2 and 3 being worse temperature wise even after repair is a known issue)
P.S:
For completeness, the PARI/GP computation done: