Monitoring Temperatures and Voltages in Linux

Introduction

The ability to monitor the temperatures of key components is important, whether you’re gaming, overclocking, or doing something more businesslike and running a critical server. Linux includes modules in the kernel that allow it to access onboard sensors within components. Though, that alone is not enough.

There is a program that does work in conjunction with those modules to display the readings of those sensors in the userspace. That program is lm_sensors. Lm_sensors allows users to get a readout of sensor readings in the command line and interfaces with several graphical front ends that make displaying temperatures in real time automatic and easy.

Installation

Lm_sensors is in nearly every distro’s repositories. In most cases, installation is as simple as a single command. Since it lm_sensors is a daemon, it will need to be started in all distributions, but the Debian based ones, which start it automatically.

Ubuntu

$ sudo apt-get install lm-sensors

Debian

# apt-get install lm-sensors

Fedora

# dnf install lm_sensors

Start up the daemon with Systemd.

# systemctl start lm_sensors
# systemctl enable lm_sensors

SUSE/openSUSE

# zypper install sensors

Start up the daemon with Systemd.

# systemctl start lm_sensors
# systemctl enable lm_sensors


Arch Linux

# pacman -S lm_sensors

Then, start the daemon.

# systemctl start lm_sensors
# systemctl enable lm_sensors

Gentoo

Ensure that the proper support is enabled in your kernel first.

Device Driver   - - -  >
	-*- I2C support   - - -  >
	<*>  I2C device interface
	<*>  Hardware Monitoring support   - - - >
[*]  Your Hardware

Then you can just emerge, start, and enable the daemon.

# emerge sys-apps/lm_sensors
# rc-service start lm_sensors
# rc-update add lm_sensors default

Reading

With the package installed and the daemon running, it is possible to run a command that will allow lm_sensors to detect all the sensors available in both the hardware and the kernel.

# sensors-detect

The program will pose a number of questions about which sensors to use. It will suggest a best option for each one. If you don’t know which sensors to pick, go with the recommendations until the end where it asks if you want to save the configuration. Always save it. Of course, you can use your best judgment regarding which sensors to use.

Detecting Sensors



Command Line

Open up a terminal, and as a regular use, run sensors.

$ sensors

That will give you a text readout of the sensors being monitored, and their current temperature or voltage readings.

GUIs

Okay, so there are a ton of GUI options to display the output of lm_sensors. Two of the most popular options are Gkrellm and Conky. Both are widely available in distribution repositories and interface very well with lm_sensors.

Gkrellm

To enable support for your sensors in Gkrellm, open up the Configuration by pressing F1 or right clicking on the border of the window. On the side of the window that opens, click on Builtins, then Sensors. In that menu, you can check off the sensors that you want Gkrellm to display.

Conky

Conky is a lot more customizable than Gkrellm, so it’s not easy to give an explicit set of instruction. Since Conky can take input in the form of variables from the execution of command line programs, that’s how you pass sensor information to it. Running exec sensors in the Conky configuration will give the output of the sensors. However, that give the whole output, so you may want to use other command line tools like grep and cut to get the exact output that you want.

Closing

Lm_sensors is a valuable tool for keeping an eye on your system’s hardware. Obviously, this guide didn’t go into every detail, but it does give a basis that is sure to get some minds turning. The GUIs also offer a ton of customization options for real time monitoring on your desktop. Enjoy keeping your computer cool and your desktop looking good.



Comments and Discussions
Linux Forum