Set up a system tray temperature monitor with KSensors

The CPU inside your computer is a very complex bit of electronics that can probably do an awful lot of number crunching. All this mathematical muscle generates heat, though, and a hot processor isn't a happy processor. Keeping an eye on your CPU temperature (and other temperatures in your system if you can) is a useful thing to do.

KDE includes a handy program for this sort of thing called KSensors. In this quick tutorial, I'm going to show you how to get up and running to get a KSensors temperature monitor for your KDE system tray. I'm using Kubuntu Feisty, but the steps here should work for most distributions.

On Linux, KSensors is a frontend for the Linux lm-sensors technology, so you'll need to have that setup first. For (K)ubuntu, there's a nice howto for that here, although it should be a case of installing lm-sensors and running the sensors-detect script (basically answering yes to everything). On my system, that's:

$ sudo apt-get install lm-sensors
$ sudo sensors-detect

Once that's done, you're ready for installing KSensors. Again, on Kubuntu:

$ sudo apt-get install ksensors

Once you're installed, launch KSensors from the K menu, or type ksensors in the Alt-F2 Run Command dialogue and press Enter. You'll get a small icon in your system tray and a blank 'canvas' window where you can drop sensors that looks something like this:

KSensors ‘canvas’ window

We don't actually want this window for this tutorial (although you can drop sensors into it yourself if you wish, personally I prefer the temperatures up in the system tray). Right-click the KSensors icon and choose Minimise to get rid of the canvas-type window.

KSensors tray icon

Now you've got just the tray icon up there. Right-click it again and choose Configure. The exact layout of the dialogue might differ depending on your hardware setup and what sensors are available to you. On my system, that involves going to the MainBoard sensors divider.

KSensors Config window

You can set a maximum value that you're happy with. If the temperature goes above that value, the sensor will change from green to red. The important part here, though, is going to the Dock tab and ticking Visible.

After clicking Apply, you should get something a little like this in your tray:

CPU temperature in system tray

It is that simple. Now this is all well and good, but you may well want KSensors to start when you login. For KDE (which the tutorial is obviously aimed at), you need to add an entry into your Autostart folder. To do that, right-click an empty part of the desktop and do Create New > Link to Application. Presentation doesn't matter, here we're interested in the Application tab. In the Command box, type ksensors and click OK.

Open up your home folder and browse to the .kde folder (use View > Show Hidden files or type the path in). In there, go into Autostart and move that launcher we just created into that folder.

Now your KSensors tray will open up every time you log in to KDE.

And that's it - we're done! Of course, feel free to customise your KSensors install; if your system supports it, you might have other temperatures you can monitor too which you can add in a similar way to the CPU temperature.

Calling all FOSSwire readers! We’re looking for your feedback - answer our reader survey and you could win an awesome FOSSwire t-shirt (we’ll ship anywhere on this planet).

Avatar for peter Peter Upfold - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Set up a system tray temperature monitor with KSensors

  1. Jonathan Richards (guest)

    # Posted on 07 July 2008 at 08:32 PM

    Thanks for that; I've just followed the instructions exactly on Kubuntu Hardy Heron on an Asus A7N8X motherboard, except that I had to run sensors-detect twice, and then I chose to insert the modules with modprobe rather than restart and let /etc/modules pick them up.

    I've been meaning to get something like this running for absolutely ages; gkrellm on KDE just isn't attractive :)

    Thanks again

    Jonathan



  2. Don (guest)

    # Posted on 08 July 2008 at 12:38 AM

    Kima also uses lm-sensors and is pretty decent (sudo apt-get install kima).



  3. Mike (guest)

    # Posted on 10 November 2009 at 09:18 PM

    Old article but still high on Google with ksensors search term. You forgot to mention installing HDD temperature. HDDs are among the most vulnerable components to excessive heat, due to their mechanical nature. sudo apt-get install hddtemp sudo chmod +s /sbin/hddtemp

    Restart ksensors and now those temps will be in its panel of sensors.

    Now set a max temperature appropriate for your drives and chipset sudo chmod +s /sbin/shutdown

    Now you can select to run a script for the alarm. Enter this in the field.

    shutdown -h now

    Now long as you're sure ksensors always loads proper on your system, your system should be protected against overheating by ksensors.



Home » Articles » Set up a system tray temperature monitor with KSensors