Plotting my laptop temperature
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Background: This kernel regression sadly RUINED my Linux computing experience for several months. I had to use the stable kernel where this problem existed due to VirtualBox modules. With my Thinkpad X220 machine reguarly hitting 80C+ it became a nightmare to work with.

Creating temp.csv

You need to save the SSH socket details from ssh-agent, like so in your .xinitrc:

ssh-agent > ${SSH_ENV}
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null

Then you echo epoch, temperature & your kernel identifier like so:

. ${SSH_ENV} > /dev/null
echo $(date +%s) $(cat /sys/class/thermal/thermal_zone0/temp) $(uname -r) $(cat /proc/loadavg) |
ssh REMOTE_HOST 'cat - >> /srv/www/'

Save that to ~/bin/temp and run it from cron like so:

*/5 * * * * ID=temp ~/bin/temp >> /tmp/temp.log 2>&1

Every 5 minutes.

Plotting temp.csv

run make

$ du -sh temp.{png,svg}
44K     temp.png
232K    temp.svg


gnuplot -p temp.gnu

And use the right mouse button to select regions, as the GNUplot video demonstrates.

Selecting ranges

Between two days ago and yesterday:

awk -v a="$(date -d '2 days ago' +%s)" -v b="$(date -d 'yesterday' +%s)" '{ if ($1 >= a && $1 <= b) print  }' temp.csv

Last two days and now:

awk -v a="$(date -d '2 days ago' +%s)" -v b="$(date +%s)" '{ if ($1 >= a && $1 <= b) print  }' temp.csv

Temperatures indicates if there is a

  • kernel problem
  • hardware issue (deployed in a place without any air circulation)
  • load issue