Monitoring your hardware's temperature
Posted by fsateler on Thu 5 Jan 2006 at 10:36
Sometimes it is useful to know the temperature of your hardware, to prevent it from frying. This information can easily be found, if your hardware provides the sensors needed, and we have the necessary software.
Most computers come with temperature sensors, which can be used to prevent your hardware from excessive heat. The most important thing to watch is, of course, your CPU temperature. This is where lm-sensors comes in. So, lets install it:
# apt-get install lm-sensors
Please notice that lm-sensors needs a recent version of i2c, so your kernel must have it installed (either via a 2.6 kernel (debian's default kernel works), or a patch to your 2.4 kernel). Once we have it installed, we need to configure it. A tool, sensors-detect can be used, but first we must ensure the necessary files are created under /dev. If you have a static /dev, you must manually create them:
# cd /dev && ./MAKEDEV i2c
If you have a dynamic /dev, then you need to load the i2c-dev module (I have only dynamic /dev systems, so I don't know if this module needs to be loaded also on those systems).
# modprobe i2c-dev
After this, you can proceed with the configuration.
# sensors-detect
Follow the instructions, throughout the wizard. Finally, we need to load the modules sensors-detect told us that should be loaded. In my case, it was i2c-viapro, i2c-isa, eeprom and w83627hf.
# modprobe -a i2c-viapro i2c-isa eeprom w83627hf
After this, we should be able to read sensor information. Just run the sample sensors program shipped with lm-sensors, and watch all your sensors! Now, there may be problems with the output: Information given by the hardware must be translated, and sometimes the configuration file doesn't handle your chip nicely. Check with your CMOS hardware monitor (probably by rebooting) that the readings are correct, and if not, modify /etc/sensors.conf (this file is extensively self-documented).
After you are done with /etc/sensors.conf, you can proceed to install a sensor monitor compatible with lm-sensors (eg: ksensors, xsensors, wmtemp). Alternatively, you might want to install the sensord daemon, which logs to syslog.
Now that we have our CPU covered, we can get worried about the next important thing: hard drives. This is simpler to set up. Just install the hddtemp package.
# apt-get install hddtemp
With the package installed, we can now check our drives temperature. Note that hddtemp must be run as root.
# hddtemp /dev/hd? /dev/hda: Maxtor 6E040L0: 40 C /dev/hdb: ST340824A: 47 C /dev/hdc: CREATIVE CD-RW RW8439E: S.M.A.R.T. not available /dev/hdd: LTN526: S.M.A.R.T. not available
As you can see, both my hard drives support temperature sensors, but my two CD drives don't. Note that hddtemp is not limited to IDE drives, it's just that I only have these.
Also, hddtemp has the ability to run as a daemon, but the
Debian installation comes disabled by default. To enable it, we must edit
/etc/default/hddtemp, and set it to RUN_DAEMON="true"
(if you want, you can set also which hard drives to check, to speed things up
a bit). Then you can run the provided init script, and hddtemp will be running.
Running hddtemp as a daemon, has the advantage of letting regular
users check the hard drives temperature, if we have netcat (or equivalent
software) installed:
$ nc localhost 7634 ; echo |/dev/hda|Maxtor 6E040L0|39|C||/dev/hdb|ST340824A|47|C|
Now you can install a frontend (such as sensors-applet), and watch your hardware's temperature in real time, and maybe be alerted of too high temperatures.
[ Send Message | View Steve's Scratchpad | View Weblogs ]
A nice introduction, thanks!
One thing that I do upon my hosts sometimes is use the thermal kernel module.
This appears to allow me to measure the CPU temperature:
root@itchy:~# modprobe thermal root@itchy:~# cat /proc/acpi/thermal_zone/THRM/temperature temperature: 23 C
I'm not sure what is required to get this working, other than ACPI, but it seemed to work on most of the machines I have access to ...
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
However, I can't seem to be able to use thermal zone:
[root@genoa2 ~]# modprobe -v thermal insmod /lib/modules/2.6.14-2-k7/kernel/drivers/acpi/processor.ko insmod /lib/modules/2.6.14-2-k7/kernel/drivers/acpi/thermal.ko [root@genoa2 ~]# cat /proc/acpi/thermal_zone/THRM/temperature cat: /proc/acpi/thermal_zone/THRM/temperature: No such file or directory [root@genoa2 ~]# ls /proc/acpi/thermal_zone/ [root@genoa2 ~]#My hardware is indeed somewhat old (from the days when AMD Athlon's (not XP) were new), so perhaps acpi thermal module needs more modern hardware than lm-sensors.
--------
Felipe Sateler
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
I'm sorry to say that I don't know what the requirements are - just I saw a mention of it on a mailing list and know it works for me ..
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Do you want to scan the ISA bus? (YES/no):
/dev/port: Operation not permitted
Syslog says:
Jan 5 14:37:16 pluto kernel: grsec: From 84.171.164.44: denied open of /dev/port by /usr/sbin/sensors-detect[sensors-detect:22934] uid/euid:0/0 gid/egid:0/0, parent /bin/bash[bash:1304] uid/euid:0/0 gid/egid:0/0
How can I allow sensors-detect accessing /dev/port?
I know this is sort of offtopic here but perhaps someone knows :-)
Thanks!
[ Parent | Reply to this comment ]
You'll have to disable this option in the kernel if you want to use /dev/port to scan for devices or skip these probes.
Regards,
Jean-Pierre
[ Parent | Reply to this comment ]
apt-get install munin munin-node
http://www.debian-administration.org/articles/229
[ Parent | Reply to this comment ]
Didnt catch that article on munin so will have to give that a blast too :)
[ Parent | Reply to this comment ]
apt-get install cacti
munin has the benefit of having a client portion (where cacti relies on the server querying the client through snmp or custom scripts), so client stats appear to be much easier to obtain.
but cacti looks better. ;-)
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Please notice that lm-sensors needs a recent version of i2c, so your kernel must have it installed (either via a 2.6 kernel (debian's default kernel works), or a patch to your 2.4 kernel). Once we have it installed, we need to configure it. A tool, sensors-detect can be used, but first we must ensure the necessary files are created under /dev. If you have a static /dev, you must manually create them:
# cd /dev && ./MAKEDEV i2c
If you have a dynamic /dev, then you need to load the i2c-dev module (I have only dynamic /dev systems, so I don't know if this module needs to be loaded also on those systems).
# modprobe i2c-dev
re-read and follow the instructions and that should get ya working.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Not the best explanation, maybe someone else can help out there :)
[ Parent | Reply to this comment ]
--------
Felipe Sateler
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Interesting article :)
Works well using the basic commands e.g.
$ hddtemp /dev/hda /dev/hda: WDC WD800JB-00JJA0: 43°C
$ smartctl -a /dev/hda ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 194 Temperature_Celsius 0x0022 099 094 000 Old_age Always - 44
Now all I need to figure is why for temperature the VALUE column and the RAW_VALUE column are so different. I mean - the RAW_VALUE always corresponds to hddtemp's result. The VALUE column is always at least double and sometimes higher - throws the munin smart graphing output completely :)
[ Parent | Reply to this comment ]
Often this VALUE is somehow reversed temperature. For example, when harddrive is in 30C degrees, the VALUE could be 100. 31C degrees could be VALUE 99. 32C degrees VALUE 98, and so on... 60 degrees VALUE 70.
In this SMART table, device is broken when VALUE reaches TRESHOLD. I do NOT know why treshhold is always 000 in harddrives, and "zero"value in VALUE always quite high, like 100. In my example VALUE 000 (broken device) would mean 130C. ...And i think HDD gets broken way before that?
[ Parent | Reply to this comment ]
New user here - decided I'd had enough of Windows-related failures and figured I'd try switching to Linux. I heard it was complicated, but have done a fair amount of computer programming in the last 20 years (from the age of 9) and would at least like to "think" I'm not a stupid idiot.
Anyway.
I followed the above instructions exactly and (I believe) lm-sensors configured correctly:
Driver `w83781d' (should be inserted):
Detects correctly:
* Bus `VIA i2c' (Bit-shift algorithm)
Busdriver `i2c-via', I2C address 0x2d (and 0x48 0x49)
ISA bus address 0x0290 (Busdriver `i2c-isa')
Chip `Winbond W83781D' (confidence: 8)
I then added these lines to /etc/modules:
# I2C adapter drivers
i2c-isa
# I2C chip drivers
w83781d
I then went to "run the sample sensors program shipped with lm-sensors" and received the message "No sensors found!"
After this, I browsed through /etc/sensors.conf - everything seemed to be in order. I rebooted, tried the sample sensors program again, and got the same message. After that, I installed the following through apt: ksensors, xsensors, wmtemp, munin, mbmon and xmbmon.
ksensors doesn't appear to display CPU temperature.
xsensors brings up an empty window, and doesn't seem to have any config options.
Now, the Windows user in me assumes that "installing a program" creates a folder with similarly-named files; searching my hard drive for "xsens" found nothing. How in the sweet beautiful fark may I begin using this program?
I was also unable to use wmtemp, munin, mbmon and xmbmon or even find where their files were supposedly installed to.
I used DOS for many years before switching to Windows, and am thinking that obviously, learning Linux through means of a GUI is not the proper way. However, back in the DOS days you could download a program from a BBS, unzip it and it would "just work." Not only that, but you would actually know where the files were. What kind of rocket science is required to find the files in the first place so that I can begin tinkering with them?
[ Parent | Reply to this comment ]
--------
Felipe Sateler
[ Parent | Reply to this comment ]
Turns out I'm just stupid and didn't know that an "AMD K6/2" is a 686 and not a 586.
Installed the i2c-686 packages and XSensors worked beautifully. :)
Now to go uninstall everything I don't need...
(But if anyone is able to spend a moment and help clarify where files go when programs are "installed," that would be very much appreciated, if somewhat off-topic.)
[ Parent | Reply to this comment ]
--------
Felipe Sateler
[ Parent | Reply to this comment ]
$ sensors
Can't access procfs/sysfs file
Unable to find i2c bus information;
For 2.6 kernels, make sure you have mounted sysfs and libsensors
was compiled with sysfs support!
For older kernels, make sure you have done 'modprobe i2c-proc'!
I am running a 2.6.15 kernel and:
$ lsmod | grep 'i2c'
i2c_dev 8832 0
i2c_sis96x 5380 0
i2c_core 19472 3 i2c_dev,eeprom,i2c_sis96x
which are the modules recommended by sensors-detect.
The /sys directory is there and contains a bus/i2c subdirectory. Am I doing something wrong here?
Thanks.
[ Parent | Reply to this comment ]
my lspci:
0000:00:00.0 Host bridge: Intel Corporation 945G/P Memory Controller Hub (rev 02)
0000:00:02.0 VGA compatible controller: Intel Corporation 945G Integrated Graphics Controller (rev 02)
0000:00:02.1 Display controller: Intel Corporation 945G Integrated Graphics Controller (rev 02)
0000:00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
0000:00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 01)
0000:00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #1 (rev 01)
0000:00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #2 (rev 01)
0000:00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #3 (rev 01)
0000:00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #4 (rev 01)
0000:00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
0000:00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
0000:00:1e.2 Multimedia audio controller: Intel Corporation 82801G (ICH7 Family) AC'97 Audio Controller (rev 01)
0000:00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
0000:00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
0000:00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) Serial ATA Storage Controllers cc=IDE (rev 01)
0000:00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
0000:01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)
No bad information in dmesg about loading adapter. The only information in dmesg is:
i2c /dev entries driver
If I look in /dev I find /dev/i2c-0.
the output of lsmod:
lsmod | grep i2
i2c_i801 8204 0
i2c_dev 9216 0
i2c_core 19840 3 i2c_i801,eeprom,i2c_dev
but the output of sensors:
Can't access procfs/sysfs file
Unable to find i2c bus information;
For 2.6 kernels, make sure you have mounted sysfs and libsensors
was compiled with sysfs support!
I have installed:
dpkg -l | grep sensors
ii libsensors3 2.10.0-4 library to read temperature/voltage/fan sens
ii lm-sensors 2.10.0-4 utilities to read temperature/voltage/fan se
Any help?
Thanks
Stefano
[ Parent | Reply to this comment ]
Doing an strace of sensors program, I see that it tries to open /sys/class/hwmon/, which is empty in my system. I have insetead /sys/bus/i2c/drivers which is populated.
Is this a problem related to udev?
[ Parent | Reply to this comment ]
hikaru:/usr/src/libsensors>sudo modprobe w83627ehf
FATAL: Error inserting w83627ehf (/lib/modules/2.6.18-4-amd64/kernel/drivers/hwmon/w83627ehf.ko): No such device
and
hikaru:/usr/src/libsensors>ls /sys/class/hwmon
hikaru:/usr/src/libsensors>
Recompiling lm-sensors did not help.
I think this might be caused by this bug:
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bu g/90265
as I have a P5B Deluxe motherboard as well.
The "solution" then would be to upgrade to kernel 2.6.22. I tried to do
that - but my custom kernel doesn't boot: it fails to put together my
RAID arrays :((. I have no clue how to solve that.
[ Parent | Reply to this comment ]
sudo modprobe w83627ehf force_id=0x8860
[ Parent | Reply to this comment ]
sensors-detect seems to work, indicates the existence of some chips in my Labtop.
But sensors concatenates the same response as described.
root@erich:~# uname -a
Linux erich 2.6.15-1-686 #2 Mon Mar 6 15:27:08 UTC 2006 i686 GNU/Linux
and
root@erich:~# lsmod | grep 'i2c'
i2c_i801 7916 0
i2c_algo_pcf 5988 0
i2c_dev 8640 0
i2c_core 19280 4 eeprom,i2c_i801,i2c_algo_pcf,i2c_dev
Who knows how to get it working?
Thanks
[ Parent | Reply to this comment ]
I'm using linux 2.6.17 and lm_sensors 2.10.0.
Hope this helps,
Hugo Leote
[ Parent | Reply to this comment ]
sysfs /sys sysfs defaults 0 0
to /etc/fstab and then remount all file systems can help.
[ Parent | Reply to this comment ]
Now follows a summary of the probes I have just done.
Just press ENTER to continue:
Driver `eeprom' (should be inserted):
Detects correctly:
* Bus `SMBus I801 adapter at 0400'
Busdriver `i2c-i801', I2C address 0x50
Chip `SPD EEPROM' (confidence: 8)
* Bus `SMBus I801 adapter at 0400'
Busdriver `i2c-i801', I2C address 0x51
Chip `SPD EEPROM' (confidence: 8)
* Bus `SMBus I801 adapter at 0400'
Busdriver `i2c-i801', I2C address 0x54
Chip `SPD EEPROM' (confidence: 8)
* Bus `SMBus I801 adapter at 0400'
Busdriver `i2c-i801', I2C address 0x55
Chip `SPD EEPROM' (confidence: 8)
(everything else was a fail)... Does anybody know how to get the temp of a Xeon cpu? I've a dual Xeon box:
michael@ratty:~$ uname -a
Linux ratty 2.6.8-3-686-smp #1 SMP Thu Feb 9 07:05:39 UTC 2006 i686 GNU/Linux
I also tried the modprobe thermal but /proc/acpi/thermal_zone/ is empty.
Thanks, Michael
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]