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

README.md

Background: This kernel regression https://bugzilla.kernel.org/show_bug.cgi?id=52411 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_ENV=$HOME/.ssh/environment
ssh-agent > ${SSH_ENV}
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null

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

#!/bin/bash
SSH_ENV=$HOME/.ssh/environment
. ${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/r2d2.webconverger.org/2012-12-27/temp.csv'

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

Zooming

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

Acknowledgements