PDA

View Full Version : [SOLVED] Conky / CPU Temp



Frogs Hair
July 29th, 2011, 04:42 PM
I am trying to use this code to add CPU temp to Conky and am getting no data . I have conky-all and lm-sensors installed . The degrees symbol C shows up , but that's all . Any thoughts on this are welcome .

${execi 30 sensors | grep 'Core0' | cut -c15-16}°C${color}${font}

ajgreeny
July 29th, 2011, 05:39 PM
Does sensors work in terminal, and are the right sensors present in your hardware? It never works in either of my two old machines. Also does lm-sesnors command need to be run as root with sudo? If so you will need to reconfigure it to be run as normal user, which I did for hddtemp (and vnstat) with
sudo chmod u+s /usr/sbin/hddtempand
sudo chmod u+s /usr/bin/vnstat

I use a similar conky syntax to show the output of hddtemp, the nearest I can get to cpu temperature, and the only difference I can see that might be a problem is that I have a space after the cut -c request:-

${alignc}${execi 60 hddtemp /dev/sda | cut -c 6-28} C
and I do not pipe twice as you do, though I can not see why these should make any difference.

srisharan
July 29th, 2011, 05:54 PM
I use this code for CPU temp.Try if this works;


${execi 8 sensors | grep -A 1 'temp2' | cut -c13-16 | sed '/^$/d'}°C

Frogs Hair
July 29th, 2011, 10:10 PM
Thank you both for the suggestions , my other Conky themes report CPU temp . This is the first I have put together my self and I will experiment and report back .

Frogs Hair
July 29th, 2011, 10:50 PM
Success ! I will have to restart to get it reporting properly . Thank you again ! :D


Mem: ${offset 9}$color$mem / $memmax${offset 10}
${color 111000}CPU 0 ${offset 9}$color${cpu cpu0}% (${execi 8 sensors | grep -A 1 'temp2' | cut -c13-16 | sed '/^$/d'}°C)
${color 111000}CPU 1 ${offset 9}$color${cpu cpu1}% (${execi 8 sensors | grep -A 1 'temp2' | cut -c13-16 | sed '/^$/d'}°C)

ajgreeny
July 30th, 2011, 04:57 PM
Great!

Just to satisfy me, can you tell me how you get the degree sign to show in your conky output on screen? If I use the degree sign from "character map" in my ~/.conkyrc file, I get a strange accented A showing, (see screenshot).

Frogs Hair
July 30th, 2011, 07:03 PM
I used the syntax that I posted . I discovered that each core does not have a sensor so I eliminated one of the lines and placed the temp. below the CPU % .

faixan
December 12th, 2011, 07:29 AM
Success ! I will have to restart to get it reporting properly . Thank you again ! :D


Mem: ${offset 9}$color$mem / $memmax${offset 10}
${color 111000}CPU 0 ${offset 9}$color${cpu cpu0}% (${execi 8 sensors | grep -A 1 'temp2' | cut -c13-16 | sed '/^$/d'}°C)
${color 111000}CPU 1 ${offset 9}$color${cpu cpu1}% (${execi 8 sensors | grep -A 1 'temp2' | cut -c13-16 | sed '/^$/d'}°C)

Hi, i just used this code in my theme config. for conky with a few tiny changes;

here's what i used after changing the code;


${color FFFFFF}${font caviar dreams:size=8}Temperature CPU0: ${cpu cpu0}% (${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C)
${color FFFFFF}${font caviar dreams:size=8}Temperature CPU1: ${cpu cpu1}% (${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C)

##output in attachment##
what i want to know is why the temperature values remain the same for both CPU's, does this mean i have only one sensor for both CPU's, i'm using Dell Inspiron 1545 with Core2Duo T6600 processor, also, if i change temp1 to temp0 OR temp2 as it was given, it doesn't show anything. so what's going on :confused: ?

faixan
December 12th, 2011, 07:38 AM
also i'm trying to add fanspeeds, and the codes i've tried, just crash conky... :s any suggestions? :s

faixan
December 12th, 2011, 03:34 PM
Success ! I will have to restart to get it reporting properly . Thank you again ! :D


Mem: ${offset 9}$color$mem / $memmax${offset 10}
${color 111000}CPU 0 ${offset 9}$color${cpu cpu0}% (${execi 8 sensors | grep -A 1 'temp2' | cut -c13-16 | sed '/^$/d'}°C)
${color 111000}CPU 1 ${offset 9}$color${cpu cpu1}% (${execi 8 sensors | grep -A 1 'temp2' | cut -c13-16 | sed '/^$/d'}°C)


Hi, i just used this code in my theme config. for conky with a few tiny changes;

here's what i used after changing the code;


${color FFFFFF}${font caviar dreams:size=8}Temperature CPU0: ${cpu cpu0}% (${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C)
${color FFFFFF}${font caviar dreams:size=8}Temperature CPU1: ${cpu cpu1}% (${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C)

##output in attachment##
what i want to know is why the temperature values remain the same for both CPU's, does this mean i have only one sensor for both CPU's, i'm using Dell Inspiron 1545 with Core2Duo T6600 processor, also, if i change temp1 to temp0 OR temp2 as it was given, it doesn't show anything. so what's going on :confused: ?


also i'm trying to add fanspeeds, and the codes i've tried, just crash conky... :s any suggestions? :s

another thing, does this "sensor temp1" show the temperature from same sensor as "acpitemp" ?

stinkeye
December 12th, 2011, 10:42 PM
Hi, i just used this code in my theme config. for conky with a few tiny changes;

here's what i used after changing the code;


${color FFFFFF}${font caviar dreams:size=8}Temperature CPU0: ${cpu cpu0}% (${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C)
${color FFFFFF}${font caviar dreams:size=8}Temperature CPU1: ${cpu cpu1}% (${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C)

##output in attachment##
what i want to know is why the temperature values remain the same for both CPU's, does this mean i have only one sensor for both CPU's, i'm using Dell Inspiron 1545 with Core2Duo T6600 processor, also, if i change temp1 to temp0 OR temp2 as it was given, it doesn't show anything. so what's going on :confused: ?
The readings from sensors vary for different motherboards.
Post the output of
sensors
eg

glen@Oneiric:~$ sensors
k10temp-pci-00c3
Adapter: PCI adapter
temp1: +31.9°C (high = +70.0°C)
(crit = +72.0°C, hyst = +70.0°C)

it8720-isa-0228
Adapter: ISA adapter
in0: +1.06 V (min = +0.00 V, max = +4.08 V)
in1: +1.92 V (min = +0.00 V, max = +4.08 V)
in2: +3.38 V (min = +0.00 V, max = +4.08 V)
+5V: +2.99 V (min = +0.00 V, max = +4.08 V)
in4: +3.10 V (min = +0.00 V, max = +4.08 V)
in5: +1.07 V (min = +0.00 V, max = +4.08 V)
in6: +3.38 V (min = +0.00 V, max = +4.08 V)
5VSB: +3.02 V (min = +0.00 V, max = +4.08 V)
Vbat: +3.23 V
fan1: 1939 RPM (min = 0 RPM)
fan2: 0 RPM (min = 0 RPM)
fan3: 1161 RPM (min = 0 RPM)
fan5: 0 RPM (min = 0 RPM)
temp1: +36.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor
temp2: +37.0°C (low = +127.0°C, high = +127.0°C) sensor = thermal diode
temp3: +79.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor
cpu0_vid: +1.250 V

faixan
December 13th, 2011, 06:38 AM
The readings from sensors vary for different motherboards.
Post the output of
sensors
eg

glen@Oneiric:~$ sensors
k10temp-pci-00c3
Adapter: PCI adapter
temp1: +31.9°C (high = +70.0°C)
(crit = +72.0°C, hyst = +70.0°C)

it8720-isa-0228
Adapter: ISA adapter
in0: +1.06 V (min = +0.00 V, max = +4.08 V)
in1: +1.92 V (min = +0.00 V, max = +4.08 V)
in2: +3.38 V (min = +0.00 V, max = +4.08 V)
+5V: +2.99 V (min = +0.00 V, max = +4.08 V)
in4: +3.10 V (min = +0.00 V, max = +4.08 V)
in5: +1.07 V (min = +0.00 V, max = +4.08 V)
in6: +3.38 V (min = +0.00 V, max = +4.08 V)
5VSB: +3.02 V (min = +0.00 V, max = +4.08 V)
Vbat: +3.23 V
fan1: 1939 RPM (min = 0 RPM)
fan2: 0 RPM (min = 0 RPM)
fan3: 1161 RPM (min = 0 RPM)
fan5: 0 RPM (min = 0 RPM)
temp1: +36.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor
temp2: +37.0°C (low = +127.0°C, high = +127.0°C) sensor = thermal diode
temp3: +79.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor
cpu0_vid: +1.250 V

here it is... and it explains a lot to me now... :( :( :(



[10:34 AM] user@ubuntu:~ $sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +59.5°C (crit = +93.0°C)


but does raise another question in my mind, doesn't hddtempalso have to be in this list? 'cause it's working in my conky config. :confused:

stinkeye
December 13th, 2011, 08:01 AM
First try hwmon in your conky as it uses less cpu.

${hwmon 0 temp 1}



or try in the terminal

sensors | grep temp1 | awk '{print $2}' | cut -c2-3
If that works, your conky line would be...

${execpi 5 sensors | grep temp1 | awk '{print $2}' | cut -c2-3}
How often to check in secs
All this line is doing is reading your sensors output, grabbing the line with "temp1" in it, taking the second string on that line (+59.5°C) and then cutting it to the 2nd and 3rd characters (ie 59)
So you can see the sensors line in conky has to be adapted according to your sensors output.


Have you configured lm_sensors yet?

* Run sudo sensors-detect and answer YES to all YES/no questions.

* At the end of sensors-detect, a list of modules that needs to be loaded will displayed. Type "yes" to have sensors-detect insert those modules into /etc/modules

* Reboot

Once rebooted run

sensors
to see if you have more sensors info.



but does raise another question in my mind, doesn't hddtempalso have to be in this list? 'cause it's working in my conky config.
Hard drive temp is read by hddtemp.
eg

hddtemp -n /dev/sda

faixan
December 14th, 2011, 07:45 AM
First try hwmon in your conky as it uses less cpu.

${hwmon 0 temp 1}


it works, and it's showing me temperature 1°C more than what i am already getting by the conky config. line i'm already using, which is;


${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C


why is that? and which one should i keep using now? ${hwmon} or ${execi} ?


or try in the terminal

sensors | grep temp1 | awk '{print $2}' | cut -c2-3
If that works, your conky line would be...

${execpi 5 sensors | grep temp1 | awk '{print $2}' | cut -c2-3}

this doesn't work... there's no output in terminal for this command. :s


How often to check in secs
All this line is doing is reading your sensors output, grabbing the line with "temp1" in it, taking the second string on that line (+59.5°C) and then cutting it to the 2nd and 3rd characters (ie 59)
So you can see the sensors line in conky has to be adapted according to your sensors output.


uderstood, thanks for explaining :)


Have you configured lm_sensors yet?

* Run sudo sensors-detect and answer YES to all YES/no questions.

* At the end of sensors-detect, a list of modules that needs to be loaded will displayed. Type "yes" to have sensors-detect insert those modules into /etc/modules

* Reboot

Once rebooted run

sensors
to see if you have more sensors info.

didn't do it earlier, just ran it without inserting sensors into /etc/modules , but just did it now and here's the out put


[11:28 AM] user@ubuntu:~ $sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +53.5°C (crit = +93.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0: +52.0°C (high = +90.0°C, crit = +90.0°C)

coretemp-isa-0001
Adapter: ISA adapter
Core 1: +52.0°C (high = +90.0°C, crit = +90.0°C)





Hard drive temp is read by hddtemp.
eg

hddtemp -n /dev/sda

so that means "hddtemp" is a seprate sensor... ?

stinkeye
December 14th, 2011, 01:22 PM
sensors | grep temp1 | awk '{print $2}' | cut -c2-3
Should work as I used your sensors output.

For Core 1 and Core 2 temps you can use in terminal to check

sensors | grep "Core 1" | awk '{print $3}' | cut -c2-3

sensors | grep "Core 2" | awk '{print $3}' | cut -c2-3

and to use in conky

${execpi 5 sensors | grep "Core 1" | awk '{print $3}' | cut -c2-3}

${execpi 5 sensors | grep "Core 2" | awk '{print $3}' | cut -c2-3}

Which is the correct temp is hard to tell with sensors.
Just use the one that matches your cpu bios temp if you have one.

If you open 3 or 4 apps at the same time
eg Software centre, System Monitor and Ubuntu One
you should see the cpu temp go up 5 or 6 degrees.

faixan
December 15th, 2011, 05:30 AM
sensors | grep temp1 | awk '{print $2}' | cut -c2-3
Should work as I used your sensors output.

this is working, and showing same output as the line i'm already using in my .conkyrc




For Core 1 and Core 2 temps you can use in terminal to check

sensors | grep "Core 1" | awk '{print $3}' | cut -c2-3

works...




sensors | grep "Core 2" | awk '{print $3}' | cut -c2-3

doesn't work... no output at all :( :(

stinkeye
December 15th, 2011, 05:47 AM
My mistake shold be core 0

sensors | grep "Core 0" | awk '{print $3}' | cut -c2-3

faixan
December 15th, 2011, 05:52 AM
My mistake shold be core 0

sensors | grep "Core 0" | awk '{print $3}' | cut -c2-3
ok, seems to be working now... lemme try it conky...

faixan
December 15th, 2011, 06:00 AM
My mistake shold be core 0

sensors | grep "Core 0" | awk '{print $3}' | cut -c2-3

here're the lines in my .conkyrc



${color FFFFFF}${font caviar dreams:size=8}CPU Temperature: ${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C
${color FFFFFF}${font caviar dreams:size=8}HWMON TEMP: ${hwmon 0 temp 1}
${color FFFFFF}${font caviar dreams:size=8}CPU-Core 0 Temperature: ${execpi 5 | sensors | grep "Core 0" | awk '{print $3}' | cut -c2-3}°C
${color FFFFFF}${font caviar dreams:size=8}CPU-Core 1 Temperature: ${execpi 5 | sensors | grep "Core 1" | awk '{print $3}' | cut -c2-3}°C
${color FFFFFF}${font caviar dreams:size=8}${exec hddname.sh sda}HDD Temperature: +${hddtemp /dev/sda}°C


and their output is in attachment :confused:

stinkeye
December 15th, 2011, 06:08 AM
here're the lines in my .conkyrc



${color FFFFFF}${font caviar dreams:size=8}CPU Temperature: ${execi 8 sensors | grep -A 1 'temp1' | cut -c13-16 | sed '/^$/d'}°C
${color FFFFFF}${font caviar dreams:size=8}HWMON TEMP: ${hwmon 0 temp 1}
${color FFFFFF}${font caviar dreams:size=8}CPU-Core 0 Temperature: ${execpi 5 | sensors | grep "Core 0" | awk '{print $3}' | cut -c2-3}°C
${color FFFFFF}${font caviar dreams:size=8}CPU-Core 1 Temperature: ${execpi 5 | sensors | grep "Core 1" | awk '{print $3}' | cut -c2-3}°C
${color FFFFFF}${font caviar dreams:size=8}${exec hddname.sh sda}HDD Temperature: +${hddtemp /dev/sda}°C


and their output is in attachment :confused:

Another mistake by me.There is no pipe between execpi and sensors

${execpi 5 | sensors
should be

${execpi 5 sensors

faixan
December 15th, 2011, 06:11 AM
Another mistake by me.There is no pipe between execpi and sensors

${execpi 5 | sensors
should be

${execpi 5 sensors

working like a charm now :) thanks, just one last thing, i'm still not clear about why there's the difference between "hwmon temp1" and "cpu temp"

does temp1 refers to some different hardware temp?

stinkeye
December 15th, 2011, 06:27 AM
working like a charm now :) thanks, just one last thing, i'm still not clear about why there's the difference between "hwmon temp1" and "cpu temp"

does temp1 refers to some different hardware temp?
hwmon temps are from sensors.

See HERE (http://ubuntuforums.org/showpost.php?p=11013044&postcount=18302) for more info.

faixan
December 15th, 2011, 06:30 AM
hwmon temps are from sensors.

See HERE (http://ubuntuforums.org/showpost.php?p=11013044&postcount=18302) for more info.

Thanks :) :)

jaws222
October 15th, 2012, 01:47 AM
this is working, and showing same output as the line i'm already using in my .conkyrc


works...


doesn't work... no output at all :( :(

5 sensors | grep temp1 | awk '{print $2}' | cut -c2-3}

Above worked for me. Awesome!! Thank You!!

wildmanne39
October 15th, 2012, 03:49 AM
Old thread closed.