lm-sensors provides a hardware health monitoring driver for Linux. It's used by system administrators to check the health status of their hardware. It is also used to monitor the hardware infrastructure in servers and be very valuable in mission critical applications. But configuring it to use is relatively easy. Below show how to install the lm sensor tool on your Ubuntu/Debian and Fedora Linux distribution.
On Ubuntu and Debian Distros
# apt install lm-sensors
On Fedora 26 and RPM Linux distros
# dnf install lm_sensors
Once the installation is done, run the following commands to check your current hardware specifications.
# sudo sensors-detect
It will ask you few questions. Answer Yes for all of them.
``` [[email protected] bin]# sensors-detect # sensors-detect revision 6284 (2015-05-31 14:00:33 +0200) # System: ASUSTeK COMPUTER INC. X540LA [1.0] (laptop) # Kernel: 4.11.11-300.fc26.x86_64 x86_64 # Processor: Intel(R) Core(TM) i3-5020U CPU @ 2.20GHz (6/61/4) This program will help you determine which kernel modules you need to load to use lm_sensors most effectively. It is generally safe and recommended to accept the default answers to all questions, unless you know what you're doing. Some south bridges, CPUs or memory controllers contain embedded sensors. Do you want to scan for them? This is totally safe. (YES/no): yes Silicon Integrated Systems SIS5595... No VIA VT82C686 Integrated Sensors... No VIA VT8231 Integrated Sensors... No AMD K8 thermal sensors... No AMD Family 10h thermal sensors... No AMD Family 11h thermal sensors... No AMD Family 12h and 14h thermal sensors... No AMD Family 15h thermal sensors... No AMD Family 16h thermal sensors... No AMD Family 15h power sensors... No AMD Family 16h power sensors... No Intel digital thermal sensor... Success! (driver `coretemp') Intel AMB FB-DIMM thermal sensor... No Intel 5500/5520/X58 thermal sensor... No VIA C7 thermal sensor... No VIA Nano thermal sensor... No Some Super I/O chips contain embedded sensors. We have to write to standard I/O ports to probe them. This is usually safe. Do you want to scan for Super I/O sensors? (YES/no): yes /dev/port: Operation not permitted Some hardware monitoring chips are accessible through the ISA I/O ports. We have to write to arbitrary I/O ports to probe them. This is usually safe though. Yes, you do have ISA I/O ports even if you do not have any ISA slots! Do you want to scan the ISA I/O ports? (YES/no): yes /dev/port: Operation not permitted Lastly, we can probe the I2C/SMBus adapters for connected hardware monitoring devices. This is the most risky part, and while it works reasonably well on most systems, it has been reported to cause trouble on some systems. Do you want to probe the I2C/SMBus adapters now? (YES/no): yes Found unknown SMBus adapter 8086:9ca2 at 0000:00:1f.3. Sorry, no supported PCI bus adapters found. Module i2c-dev loaded successfully. Next adapter: i915 gmbus vga (i2c-0) Do you want to scan it? (yes/NO/selectively): yes Next adapter: i915 gmbus dpc (i2c-1) Do you want to scan it? (yes/NO/selectively): yes Next adapter: i915 gmbus dpb (i2c-2) Do you want to scan it? (yes/NO/selectively): yes Next adapter: i915 gmbus dpd (i2c-3) Do you want to scan it? (yes/NO/selectively): yes Next adapter: DPDDC-A (i2c-4) Do you want to scan it? (yes/NO/selectively): yes Next adapter: DPDDC-B (i2c-5) Do you want to scan it? (yes/NO/selectively): yes Next adapter: SMBus I801 adapter at 4040 (i2c-6) Do you want to scan it? (YES/no/selectively): yes Client found at address 0x52 Probing for `Analog Devices ADM1033'... No Probing for `Analog Devices ADM1034'... No Probing for `SPD EEPROM'... Yes (confidence 8, not a hardware monitoring chip) Next adapter: Synopsys DesignWare I2C adapter (i2c-7) Do you want to scan it? (YES/no/selectively): yes Adapter doesn't support all probing functions. Some addresses won't be probed. Next adapter: Synopsys DesignWare I2C adapter (i2c-8) Do you want to scan it? (YES/no/selectively): yes Adapter doesn't support all probing functions. Some addresses won't be probed. Now follows a summary of the probes I have just done. Just press ENTER to continue: Driver `coretemp': * Chip `Intel digital thermal sensor' (confidence: 9) Do you want to overwrite /etc/sysconfig/lm_sensors? (YES/no): yes Unloading i2c-dev... OK [[email protected] bin]# ```
Finally to get your CPU temperature type
sensors in your terminal. This tests that the
lm-sensors tool works correctly. Also, to check the CPU temperature, fan speed and other data run the following command:
[[email protected] bin]# sensors asus-isa-0000 Adapter: ISA adapter cpu_fan: 2100 RPM temp1: +49.0°C acpitz-virtual-0 Adapter: Virtual device temp1: +49.0°C (crit = +108.0°C) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +50.0°C (high = +105.0°C, crit = +105.0°C) Core 0: +49.0°C (high = +105.0°C, crit = +105.0°C) Core 1: +50.0°C (high = +105.0°C, crit = +105.0°C) pch_wildcat_point-virtual-0 Adapter: Virtual device temp1: +47.0°C
This sensors output shows two devices: asus-isa-0000 (motherboard sensors) and ccoretemp-isa-0000 (Intel Core sensors). The motherboard sensor device has information on the voltages received from the power supply unit by the motherboard (in1-6), the fan speeds (entries with RPM), and various internal temperatures.
2) Install and customize the lm-sensor GUI: Psensor
a) Install psensor
If you don't want to use lm-sensor with the terminal, you can install psensor which is the GUI For lm-sensors.
On Debian system
# apt install psensor Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libappindicator3-1 libdbusmenu-glib4 libdbusmenu-gtk3-4 libindicator3-7 libjson-c3 libxnvctrl0 psensor-common The following NEW packages will be installed: libappindicator3-1 libdbusmenu-glib4 libdbusmenu-gtk3-4 libindicator3-7 libjson-c3 libxnvctrl0 psensor psensor-common
On Redhat systems psensor isn’t available from the default system repository so, you will need to compile it from source. We will first need to install wget
# dnf install wget Last metadata expiration check: 0:24:13 ago on Wed 23 Aug 2017 03:54:38 AM UTC. Dependencies resolved. ====================================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================================== Installing: wget x86_64 1.19.1-3.fc26 fedora 725 k
Now install the required packages for the compilation
# dnf group install 'Development Tools' Last metadata expiration check: 0:50:12 ago on Wed 23 Aug 2017 03:54:38 AM UTC. Dependencies resolved.
Now you can download the last version of psensor (1.2.0) when writing this articlefrom the source
# wget http://wpitchoune.net/psensor/files/psensor-1.2.0.tar.gz --2017-08-23 04:31:01-- http://wpitchoune.net/psensor/files/psensor-1.2.0.tar.gz Resolving wpitchoune.net (wpitchoune.net)... 220.127.116.11
now you can uncompress it
# tar xvf psensor-1.2.0.tar.gz psensor-1.2.0/ psensor-1.2.0/test-driver psensor-1.2.0/ar-lib
Now we can compile psensor
# cd psensor-1.2.0
# ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes
# make install Making install in doc make: Entering directory '/root/psensor-1.2.0/doc' make: Entering directory '/root/psensor-1.2.0/doc'
b) Launch and customize psensor
Now that psensor is installed, you can launch it via the graphical menu to have a result as below:
You can choose which element will appear on the graph by unsticking it on the right as below where we have deselected temp1, Core1, and ST500LT012-1DG142
You have the possibility to edit the psensor preferences. You can edit
- Preferences: where you can modify how the tool will start, its interface or the graph presentation as below through Psensor -> preferences
- Sensor Preferences: here you can edit how the psensor tool will operate on the monitored services such as alarms to have notifications or modifying the name of the services as below through Psensor -> Sensor Preferences
Then you can see a notification which can appear as below
lm-sensors is a very useful tool for performing hardware health checks. However, due to the poor CLI interface, most users prefer GUI-based applications. However, lm-sensor can be configured to use GUI tools such as
psensor which is a GTK application that shows the graphs of CPU, HDD temperature, fan speeds etc.
lm-sensors can be further configured to control the system fans using the
fancontrol script. This can easily be done running the
sudo pvmconfig command and follow the instructions carefully.