Wednesday, April 13, 2011

Show CPU Core temperatures in Conky

For some reason, that I have yet to fully understand, the Conky variable acpitemp didn't work for me in Ubuntu on the Dell E520. It just constantly gave 0°C as the CPU temperature.
Even though I had installed acpi, running the command "acpi -t" gave no output in a terminal.
Luckily I came across this thread of a few years ago. Oldish, but I learned a lot which probably shows how behind the times I am.
First, to get temperatures for my CPU (Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz), I just had to install lm-sensors from the Ubuntu repos.
Then, running the command

# sensors

gives the output
Adapter: ISA adapter
Core 0: +69.0°C (high = +84.0°C, crit = +100.0°C)

Adapter: ISA adapter
Core 1: +67.0°C (high = +84.0°C, crit = +100.0°C)

So, it only remains to get this information in to Conky. Actually, as I only need the temperatures and not the other stuff, I need to use the "cut" switch.
The line I used in .conkyrc is this:
Core Temps: $alignr ${execi 6 /usr/bin/sensors | grep [+] | cut -d"+" -f2 | cut -d"(" -f1}

You can see in the screenshot how it looks.

To get the HDD temperature into Conky, I had to install hddtemp and, once again, it's in the repos.
Then I added this line to .conkyrc
HDD temp: $alignr ${hddtemp /dev/sda}°C

No comments:

Post a Comment