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.
[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.
[ Parent ]
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 ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
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 ]
[ Parent ]
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 ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ 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:
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 ...
Steve
[ Parent ]