Temperature monitoring *in linux*

The forum for non-component-related silent pc discussions.

Moderators: NeilBlanchard, Ralf Hutter, sthayashi, Lawrence Lee

Post Reply
Qwertyiopisme
Posts: 237
Joined: Tue Nov 11, 2003 6:48 am
Location: Gothenburg, Sweden
Contact:

Temperature monitoring *in linux*

Post by Qwertyiopisme » Sat Oct 15, 2005 10:34 am

One of the few things that I cannot/do not know how to do in linux that I want to be able to do before I switch is monitor temperatures, prefferably in a way similar to speedfan (speed control is a plus, but monitoring is the main thing I want to do). Does anybody know of any programs? (prefferably with a nice GUI).

kesv
Posts: 300
Joined: Fri Nov 07, 2003 8:44 am

Re: Temperature monitoring *in linux*

Post by kesv » Sat Oct 15, 2005 11:05 am

In Linux the monitoring of temperatures and voltages consists of two different pieces of software. First you need a tools package called lm_sensors. Once you have that installed and configured, you can use several nice gui utilities to display the information produced by it. One popular package is gkrellm.

Most of the popular distros should offer both of the above as convenient packages.

dukla2000
*Lifetime Patron*
Posts: 1465
Joined: Sun Mar 09, 2003 12:27 pm
Location: Reading.England.EU

Post by dukla2000 » Sat Oct 15, 2005 11:16 am

^^^
What the man says! In SuSE sensors is installed with the standard installation. The gkrellm package is an optional extra: not included in the default instal but available as a binary on the installation media.

Not only that but you can get additional plugins to monitor CPU speed, folding progress etc etc (as you can see on their page). Doesn't do fan control - only reporting as well as voltage reporting.

ckolivas
Posts: 393
Joined: Thu Jan 27, 2005 7:16 am
Location: Melbourne, Australia
Contact:

Post by ckolivas » Sun Oct 16, 2005 1:52 am

Actually fan control works well too. The fan control software is not enabled by default but included in the sensors packages so you have to look carefully. It will spin up every fan to top speed, then drop each pwm controller one by one to minimum and start increasing the value and ask you to check when the fans start turning. Then you set lowest and top temperature and it will start the fans at minimum pwm setting to make sure they start turning and turn up the motherboard pwm setting as the temperature rises. Provided the temperature monitoring sensors have drivers for your motherboard (new ones come out every other day) you can have all the fan speed control you desire.

As for guis, I really like ksensors which shows me all I need. Unfortunately my fans all run 300-550 rpm so the rpm sensors are pretty much useless since the motherboard sensors can't read that low... but then that's not a linux specific problem.

StarfishChris
Posts: 968
Joined: Fri Jan 07, 2005 7:13 pm
Location: Bristol, UK
Contact:

Post by StarfishChris » Sun Oct 16, 2005 5:01 am

Those scripts are fancontrol and pwmconfig. The former monitors temperatures and adjusts fan speeds automatically, the second configures the fancontrol script. I cannot vouch for how well they run because I use a fixed speed, but pwmconfig needs fans with RPM sensing to work.

Ksensors works nicely with KDE also.

scaryduck
Posts: 115
Joined: Sat Mar 05, 2005 10:31 am
Location: London, UK

Post by scaryduck » Sun Oct 16, 2005 5:13 am

xsensors is ia GTK alternative to ksensors. gDesklets (GNOME's karamba clone) can also display temperatures and the like. There's also an GNOME panel applet that can display (and optionally graph) temperatures.

Use the MBM website to find the hardware monitoring chip your board uses. Uncomment the relevant section in /etc/sensors.conf. You can rename Temp1, Temp2, etc. to whatever you want. It's all documented in sensors.conf.

Alternatively, you might be able to find a pre-configured sensors.conf for your board on Google.

dukla2000
*Lifetime Patron*
Posts: 1465
Joined: Sun Mar 09, 2003 12:27 pm
Location: Reading.England.EU

Post by dukla2000 » Sun Oct 16, 2005 6:05 am

ckolivas wrote:Actually fan control works well too.
StarfishChris wrote:Those scripts are fancontrol and pwmconfig.
:D
Just been learning more about Linux and (of course) you are right, and my hsf fan is now under fancontrol fan and stopped :) The downside is the stupid pwm control on this mobo seems to be binary on or off with very little (if anything) in between. pwmconfig ran from 255 down to 0 and the only meaningful step was from 15 (full rpm) to 0 (off). I noticed the same thing with Speedfan though: will need to check if I can get any resolution between 0 and 15!

ckolivas
Posts: 393
Joined: Thu Jan 27, 2005 7:16 am
Location: Melbourne, Australia
Contact:

Post by ckolivas » Sun Oct 16, 2005 6:07 am

dukla2000 wrote:
ckolivas wrote:Actually fan control works well too.
StarfishChris wrote:Those scripts are fancontrol and pwmconfig.
will need to check if I can get any resolution between 0 and 15!
Don't bother; the value changes in increments of 16 - there is no more resolution in the pwm system. Oh and do be patient, dropping the pwm setting it can take up to a minute to slow down to it's stabilised speed.

JonV
Posts: 107
Joined: Mon Aug 15, 2005 8:05 pm

Post by JonV » Sun Oct 16, 2005 6:38 am

I happened to be fiddling with this just earlier today. I put together an incredibly crude little script to list the interesting sensor readings from various programs. Just thought I'd post it here in case it could be of use to anyone:

Code: Select all

#!/bin/sh
echo "CPU:" `sensors | tail -14 | head -1 | sed "s/°.*//" | sed "s/[^0-9]*//"`
echo "GPU:" `nvidia-settings --query=GPUCoreTemp | sed "s/.*0.0): //" | sed "s/[^0-9]//" | head -1`
echo "HD1:" `smartctl -A -d ata /dev/sda | tail -10 | head -1 | sed "s/.*-//" | sed "s/[^0-9]*//"`
echo "HD2:" `smartctl -A -d ata /dev/sdb | tail -10 | head -1 | sed "s/.*-//" | sed "s/[^0-9]*//"`
The various numbers used with tail may have to be adjusted depending on your hardware to match the relevant line number in the program output (counted backwards from the end).

As an aside, I realize my solutions here are probably far from the best / most elegant way to do this. Anyone got any pointers on sed / awk / whatever that would help me improve my text mangling skills? My main problem seemed to be to find a simple way to extract the relevant part, as opposed to removing the irrelevant parts, of the output.

ckolivas
Posts: 393
Joined: Thu Jan 27, 2005 7:16 am
Location: Melbourne, Australia
Contact:

Post by ckolivas » Sun Oct 16, 2005 6:50 am

sensors | grep CPU
?

JonV
Posts: 107
Joined: Mon Aug 15, 2005 8:05 pm

Post by JonV » Sun Oct 16, 2005 6:53 am

ckolivas wrote:sensors | grep CPU
?
Ah, well, I was more referring to the sed stuff. Mangling the text to extract just the number.

palmem
Posts: 18
Joined: Wed Sep 28, 2005 4:51 pm

Post by palmem » Sat Nov 19, 2005 5:58 pm

In case your still wondering about the sed stuff:

Code: Select all

sensors | grep 'CPU Temp:' | sed s/'\ \{2,\}'/' '/ | sed s/'\ \{2,\}'/' '/ | sed s/'\ \{2,\}'/' '/ | sed s/'\ \{2,\}'/' '/ | sed s/'\ \{2,\}'/' '/ | sed s/'\ \{2,\}'/' '/ | cut -d ' ' -f 3 | sed s/'\+'/''/
I think that that can go into one sed...

-palmem[/code]

kloppe
Posts: 61
Joined: Sun Mar 21, 2004 6:51 am
Location: Sweden

Post by kloppe » Sun Nov 20, 2005 4:39 am

Not very good with regular expressions, but:

Code: Select all

sensors | grep 'CPU Temp:' | sed s/'\ \{2,\}'/' '/g | cut -d ' ' -f 3 | sed s/'\+'/''/
should work.

Post Reply