monitor (andoird) devices with bpf: https://www.socallinuxexpo.org/sites/default/files/presentations/bcc-scale.pdf

How to monitor system temperature on Linux

In most cases, you are not supposed to be worried about the temperature of your computer. Barring manufacturing defects, hardware is designed so that its temperature does not exceed maximum operating temperature. But even without any hardware fault, overheating can occur due to various software issues, e.g., buggy graphics card driver, misconfigured fan control program, malfunctioning CPU frequency scaling daemon, etc. As pointed out by Ben in the comment, another quite common cause for overheating is dust, dirt and debris clogging the cooling system (fan, heat sink and ventilation openings). I can imagine this could happen quite often with older hardware.

Overheating may become serious enough to cause permanent damage on your hardware. So watch out for any overheating issue in your system. Even better, have temperature monitoring system in place, so that you will be alerted if system temperature suddenly goes up.

In this tutorial, I will describe how to monitor system temperature on Linux.

There are several user space tools on Linux, which allow you to check and monitor temperature of various system components.

lm-sensors is a software tool that draws from hardware embedded sensors to monitor temperatures, voltage, humidity and fans. hddtemp is a tool that can measure the temperature of hard drives from S.M.A.R.T. readings. psensor is a graphical front-end for temperature monitoring, which visualizes temperature readings from CPUs, NVidia/ATI/AMD GPUs, hard disks, etc.

In the following, I will describe how to set up psensor to monitor the temperature of CPUs and hard drives.

Install psensor on Linux Desktop

psensor can visualize system temperature based on the information obtained from other tools such as lm-sensors and hddtemp. Thus you need to install psensor along with those prerequisites.

To install psensor on Debian or Ubuntu:

su - root
apt update
# since debian hddtemp dropped out of the race
apt install lm-sensors psensor

Another way to install psensor on Ubuntu is to use their PPA repository which contains a more recent version of psensor.

su - root
add-apt-repository ppa:jfi/ppa
apt-get update
apt-get install lm-sensors hddtemp psensor

To install psensor on Fedora:

checkout what is the latest version of psenor gui gadget http://wpitchoune.net/psensor/files/

sudo yum install lm_sensors hddtemp;
yum install gcc gtk3-devel GConf2-devel lm_sensors-devel cppcheck libatasmart-devel libcurl-devel json-c-devel libmicrohttpd-devel help2man libnotify-devel libgtop2-devel make;
wget http://wpitchoune.net/psensor/files/psensor-1.2.0.tar.gz;
tar xvfvz psensor-1.2.0.tar.gz;
cd psensor-1.2.0;
./configure;
make;
sudo make install;

Due to the requirement for GTK3 libraries, psensor is not compatible with the GNOME 2 desktop of CentOS or RHEL 6.

Configure psensor on Linux

Before launching psensor, you need to configure lm_sensors and hddtemp first.

lm_sensors configuration

# To configure lm_sensors, run the following command. Choose YES to every question.
sensors-detect
# for some reason on AMD systems NO sensors were detected
# but simply run as root
sensors
# and something should show up

This command will probe for and detect embedded sensors in your hardware (including CPUs, memory controllers, I/O chips), and automatically determine which driver modules need to be loaded to check temperature on your system.

Once sensor probing is completed, you will be asked to add detected driver module(s) to /etc configuration, so they can be loaded automatically upon boot.

linux scan for sensors

On Debian or Ubuntu, detected driver modules will be added to /etc/modules. On Fedora, the driver information will be added to /etc/sysconfig/lm_sensors.

Next, proceed to load necessary modules as follows.

On Ubuntu:

sudo service module-init-tools start

On Debian:

sudo /etc/init.d/kmod start

On Fedora:

service lm_sensors start

how to read harddisk temperature:

hddtemp /dev/sda

# a central surveillance server could query the deamon

# run hddtemp in TCP/IP daemon mode (port 7634 by default).

hddtemp -d /dev/sd

manpage: hddtemp.man.txt

terminal based

output current sensor readings on terminal via:

sensors

watch sensors; # repeat that output every second

which looks like:

Monitor System Temperature with psensor

To start monitoring temperature with psensor, simply run:

psensor

The psensor window will show a list of available sensors, and visualize temperature readings from these sensors. You can selectively enable or disable each sensor.

PSensor ScreenShot Laptop Dell

Optionally, you can set an alarm level for each sensor, so that you can be notified when the temperature from a sensor exceeds a threshold.

psensor preferences

The default temperature unit used by psensor is Celsius. A recent version (0.7–0.8) of psensor can convert temperature unit between Celsius and Fahrenheit. If the version of psensor you are using is outdated (e.g., 0.6.x), and does not have unit conversion, install psensor from its PPA repository (for Ubuntu users) or build it from its source (for Debian users).

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin