By: Michael L Farrell
Do you own a laptop? Or perhaps an old clunker pc that you’re using as a Linux server? Do you know how hot your CPU is running? Fact is, all CPU chips are rated for specific temperature ranges. Go over the maximum, and your computer may no longer run to specification, resulting in random behavior, crashes, lockups, or expensive damage to your hardware! Modern Linux kernels make use of temperature monitoring hardware to help you stay on top of this situation. This article will show you how to get at it.
The first thing you need to do, is verify that you have the sensor capability, and to initialize it for your system.
First lets check (as root)
slickbox:/home/kain # acpi -t Battery 1: charged, 100% Thermal 1: ok, 60.0 degrees C Thermal 2: ok, 27.0 degrees C
If you don’t see the above output after “acpi -t”, then you need to setup your sensors. Under some hardware and older systems, using the sensors-detect command is necessary.
slickbox:/home/kain # sensors-detect ... slickbox:/home/kain # sensors ... CPU: +35°C (low = +10°C, high = +50°C) Board: +35°C (low = +10°C, high = +35°C) Remote: +33°C (low = +10°C, high = +35°C) ...
These sensors commands spit out a little more information than just temperature such as voltage measurements, feel free to explore them if they are available. Either way, you should be able to access your thermal information through one of these two facets. For example, my desktop uses the “sensors” commands, and my laptop information is available through the acpi interface.
The next thing you need to do is is verify that you have the system monitoring utility, gkrellm installed on your system.
kain@slickbox:~> rpm -qa|grep gkrellm gkrellm-2.2.7-14 kain@slickbox:~> # goood! Now lets start it kain@slickbox:~> gkrellm &
If you don’t have gkrellm, then install it using the “add programs” feature under Yast2 control panel for OpenSuSE systems.
We now need to add the sensors to the gkrellm panel. We do this by right clicking the gkrellm panel and saying “configure…”
In the configuration pane, select “sensors” and then expand the temperatures tree to expose your available sensors. Check the boxes as they apply to any information you would like gkrellm to monitor for you.
Note that much more than CPU thermal information may become available for you to display and monitor. For example, my laptop has the capability to monitor the GPU (graphics card unit) temperature as well.
After clicking okay, you should now see the thermal information displayed right above the disk information on the gkrellm monitor.
Leaving gkrellm running is always a good system practice so you can stay on top of your system’s resource usage. I tend to always leave mine running on one of my virtual desktops and check it frequently.
Lastly, you’ll want to ensure that your system never goes above out of its rated temperature range. You can view the system critical temperature for your unit if you have ACPI support by running this command.
kain@slickbox:~> cat /proc/acpi/thermal_zone/TZ01/trip_points critical (S5): 99 C
Note that this value may not be accurate and you may want to google your specific processor model.
kain@slickbox:~> cat /proc/cpuinfo |grep model model : 14 model name : Genuine Intel(R) CPU T2300 @ 1.66GHz
Turns out, anything over 95 degrees celsius is dangerous for my CPU. So lets have gkrellm let me know if I get anywhere close.
Go back to the previous sensors configuration screen and click the CPU zone (usually zone 1). Next, click alerts and a configuration window will appear. For my laptop, I have the warning temperature set to 85 degrees and the high alarm temperature set to 91.
In this example, a high alarm causes my cdrom tray to eject (rather silly, but it gets my attention). Be sure that /dev/hda is your cdrom device if you decide to use this example. For a alarm command I use the xheat utility, which brightens my screen (restored with xheat -n). Feel free to use any commands you want here to ensure your system safety. For example, if you know you won’t be using the computer very often, you may decide to run a system shutoff or hibernate command instead here.
Thats all there is to it. Now if anything goes wrong with your cooling system, you’ll be prepared!