Introduction

Ubuntu can monitor CPU and other system temperatures, fan speeds, and voltages via command line, using the package lm-sensors, or via GUI applets in your desktop.

Monitoring sensors via the command line with lm-sensors

  1. Install the lm-sensors package (see InstallingSoftware).

  2. Run sudo sensors-detect and choose YES to all YES/no questions.

  3. At the end of sensors-detect, a list of modules that needs to be loaded will displayed. Type "yes" to have sensors-detect insert those modules into /etc/modules, or edit /etc/modules yourself.
  4. Monitoring programs won't work until the needed modules are loaded. You may want to run 'service kmod start' to load them.

Test lm-sensors

Next, you should test that lm-sensors works correctly. Run the "sensors" command and check the output. Example output is below:

w83627dhg-isa-0290
Adapter: ISA adapter
VCore:       +1.13 V  (min =  +0.00 V, max =  +1.74 V)   
in1:        +11.30 V  (min =  +0.90 V, max =  +0.05 V)   ALARM
AVCC:        +3.28 V  (min =  +2.11 V, max =  +2.40 V)   ALARM
3VCC:        +3.28 V  (min =  +2.05 V, max =  +0.37 V)   ALARM
in4:         +1.41 V  (min =  +0.00 V, max =  +1.57 V)   
in5:         +1.65 V  (min =  +0.02 V, max =  +0.14 V)   ALARM
in6:         +4.45 V  (min =  +3.28 V, max =  +1.64 V)   ALARM
VSB:         +3.28 V  (min =  +0.14 V, max =  +3.07 V)   ALARM
VBAT:        +3.22 V  (min =  +2.06 V, max =  +1.02 V)   ALARM
Case Fan:      0 RPM  (min = 2636 RPM, div = 128)  ALARM
CPU Fan:    1117 RPM  (min = 1591 RPM, div = 8)  ALARM
Aux Fan:       0 RPM  (min = 1171 RPM, div = 128)  ALARM
fan5:          0 RPM  (min =  659 RPM, div = 128)  ALARM
Sys Temp:    +31.0°C  (high = +18.0°C, hyst = +96.0°C)  sensor = thermistor
CPU Temp:    +33.0°C  (high = +80.0°C, hyst = +75.0°C)  sensor = diode
AUX Temp:   +124.5°C  (high = +80.0°C, hyst = +75.0°C)  ALARM  sensor = thermistor
cpu0_vid:   +1.163 V

coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +43.0°C  (high = +82.0°C, crit = +100.0°C)  

coretemp-isa-0001
Adapter: ISA adapter
Core 1:      +43.0°C  (high = +82.0°C, crit = +100.0°C)  

coretemp-isa-0002
Adapter: ISA adapter
Core 2:      +40.0°C  (high = +82.0°C, crit = +100.0°C)  

coretemp-isa-0003
Adapter: ISA adapter
Core 3:      +43.0°C  (high = +82.0°C, crit = +100.0°C)  

This sensors output shows four devices: w83627dhg-isa-0290 (motherboard sensors) and coretemp-isa-0000 through 0004 (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. As you can see, some sensors are obviously incorrect (e.g. AUX Temp and Case/Aux Fan); this tends to be the case with at least some of the sensors on most motherboards.

The sensor output may be tweaked by editing the "/etc/sensors.conf" file. It is possible to correct inaccurate scaling too. For details check "man sensors.conf".

Monitoring sensors on your desktop

Unity System Load Indicator

In Unity one may use System Load Indicator via the Ubuntu Software Center.

psensor

Psensor is a GTK application that shows graphs of CPU, GPU, hard drive temperatures, and fan speeds, including remote computers if needed.

sensors-applet

sensors-applet.png

You may apt-get or search via Synaptic for sensors-applet, a GNOME panel applet that displays temperature, voltage, and fan speeds.

During installation, you'll be presented with the option to start the hddtemp daemon at startup. Choose "no" here if there was a sensor detected previously that reports your hard drive temperature, otherwise choose "yes".

After installation, you can right click on any panel that you want to have sensor information displayed on, and click "Add to Panel..." . In the "Add to Panel" window, there should be a icon with the text "Hardware Sensors Monitor" (You may need to restart before the option appears). Click on this entry, then click "Add". You can change the applet's settings by right-clicking on the applet and choosing "Preferences".

Xubuntu xfce4-sensors-plugin

xfce4-sensors-plugin.png

In Xubuntu, you can install xfce4-sensors-plugin via apt-get or Synaptic search/install "xfce4-sensors-plugin". This is an XFCE panel plugin that displays temperatures and fan speeds from lm-sensors.

After installation, you can secondary click on any panel that you want to have sensor information displayed on, and click "Add to Panel...". In the "Add to Panel" window, there should be a icon with the text "Sensor plugin". Click on this entry, then click "Add". You can change the plugin settings by right-clicking on the plugin and choosing "Properties".

Controlling fanspeeds according to sensor values

Together with the lm-sensors package comes a script called fancontrol. It can be used to software-control your system fans.

Configuration

Configuration of installed PWM-capable fans can be done with the script pwmconfig. Run sudo pwmconfig and follow the instructions carefully. The output of pwmconfig is a config file containing the definitions of which temperature sensor controls which fan. Here comes an example:

# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=5
DEVPATH=hwmon1=devices/platform/coretemp.0 hwmon2=devices/platform/it87.2608
DEVNAME=hwmon1=coretemp hwmon2=it8728
FCTEMPS=hwmon2/device/pwm3=hwmon1/device/temp1_input hwmon2/device/pwm2=hwmon1/device/temp1_input
FCFANS=hwmon2/device/pwm3=hwmon2/device/fan4_input+hwmon2/device/fan3_input hwmon2/device/pwm2=hwmon2/device/fan2_input
MINTEMP=hwmon2/device/pwm3=38 hwmon2/device/pwm2=38
MAXTEMP=hwmon2/device/pwm3=60 hwmon2/device/pwm2=60
MINSTART=hwmon2/device/pwm3=70 hwmon2/device/pwm2=70
MINSTOP=hwmon2/device/pwm3=70 hwmon2/device/pwm2=70
MINPWM=hwmon2/device/pwm3=70 hwmon2/device/pwm2=70
MAXPWM=hwmon2/device/pwm3=255 hwmon2/device/pwm2=255

Remember, after running the script you can still edit the configuration manually (standard path of config-file: /etc/fancontrol).

Running `fancontrol`

Running fancontrol when booting should work out of the box. After installing lm-sensors, the fancontrol script is treated as a service and should be found under /etc/init.d/fancontrol.

Reinitialization after suspend to RAM/Disk

Currently fancontrol fails after STD, STR: Fancontrol ignores settings after suspend to ram/disk. Here comes a possible solution:

Creating a pm-utils hook

Hooks are pm-utils scripts being run at SUSPEND- and RESUME procedures. You can create your own ones and place them in /etc/sleep.d; etc/power.d, depending on which energy saving modes are utilized. Here comes the specific one for the fancontrol service.

# 51fancontrol_restart: reload fancontrol service after suspend

. "${PM_FUNCTIONS}"

case "$1" in
    suspend)
        echo "Stopping fancontrol service ..."
        stopservice fancontrol && echo Done. || echo Failed.
        ;;
    resume)
        echo "Starting fancontrol service  ..."
        restartservice fancontrol && echo Done. || echo Failed.
        ;;
esac
exit 0

Save this one under 51fancontrol_restart, run chmod 755 51fancontrol_restart and put it in /etc/sleep.d. Resuming fancontrol should work now after suspending. To doublecheck take a look at pm-suspend.log in var/log/.

Links

lm-sensor's homepage http://www.lm-sensors.org/


SensorInstallHowto (last edited 2015-06-05 07:54:01 by penalvch)