Jump to content

Checking CPU temperature

Publication Date: 09/24/2021

1 Environment

  • File Name: task-check-cpu-temperature.xml
  • ID: environment-check-cpu-temperature

This document applies to the following products and product versions:

  • SUSE Linux Enterprise Server 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

  • SUSE Linux Enterprise Server for SAP Applications 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

  • SUSE Linux Enterprise High Availability Extension 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

  • SUSE Linux Enterprise High Performance Computing 15 SP3, 15 SP2, 15 SP1, 15 GA

  • SUSE Linux Enterprise Desktop 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

  • SUSE Linux Enterprise Real Time 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

2 Introduction

  • File Name: task-check-cpu-temperature.xml
  • ID: introduction-check-cpu-temperature

Keeping track of CPU temperature has several benefits.

  • Energy savings and cost reduction. If all your CPUs are running at full speed, it takes much more energy than if they are idling. Also cooling down CPUs is a critical cost factor, especially in data centers.

  • Identifying unwanted processes that takes too much CPU power. This can be a program going wild due to a software problem, or when a process occupies a CPU for too long time. Identifying such processes help to free your CPU resources from being unavailable and keep CPU responsive.

  • Better protection of the CPUs and the hardware. CPUs has a thermal protection when the CPU gets too warm. This protects it from overheating. However, if a CPU temperature reaches 80°C or higher, it is a warning sign that something is wrong. It can be that a fan is dead, the cooling system does not work properly, or the thermal paste wasn't applied correctly.

  • A long-term reduction of the carbon footprint can be achieved by adjusting the cooling parameters.

Follow the instruction below to learn how to monitor your CPU temperature.

3 Requirements

  • File Name: task-check-cpu-temperature.xml
  • ID: requirements-check-cpu-temperature
  • Root permissions to install the required package

  • The package sensors

4 Preparing the hardware sensors

  • File Name: task-check-cpu-temperature.xml
  • ID: prepare-hardware-sensors

Before you can measure the CPU temperature, check what hardware sensors are available in your computer:

  1. Install the required package:

    zypper install sensors
  2. To detect all the sensors in your system, run the following command as root:

    root # sensors-detect

    When prompted to detect specific hardware monitoring chips, accept the default answer is YES by pressing . At the end, the script shows a summary of what chips were detected:

    Now follows a summary of the probes I have just done.
    
    Driver `coretemp':
      * Chip `Intel digital thermal sensor' (confidence: 9)
    
    Driver `to-be-written':
      * ISA bus, address 0xa40
        Chip `ITE IT8686E Super IO Sensors' (confidence: 9)
    
    Do you want to generate /etc/sysconfig/lm_sensors? (YES/no):
  3. Confirm to generate the file /etc/sysconfig/lm_sensors. After confirmation, the script creates a systemd service (/usr/lib/systemd/system/lm_sensors.service.) that is enabled by default.

Check the status of the systemd service:

sudo systemctl status lm_sensors
● lm_sensors.service - Initialize hardware monitoring sensors
   Loaded: loaded (/usr/lib/systemd/system/lm_sensors.service; enabled; vendor preset: disabled)
   Active: active (exited) since Fri 2021-09-10 16:57:55 CEST; 2min 23s ago
  Process: 32552 ExecStart=/usr/bin/sensors -s (code=exited, status=0/SUCCESS)
  Process: 32551 ExecStart=/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES (code=exited, status=0/SUCCESS)
 Main PID: 32552 (code=exited, status=0/SUCCESS)
    Tasks: 0
   CGroup: /system.slice/lm_sensors.service

Sep 10 16:57:55 edison systemd[1]: Starting Initialize hardware monitoring sensors...
Sep 10 16:57:55 edison systemd[1]: Started Initialize hardware monitoring sensors.

After you have completed these steps, your computer has detected all sensors and has started to monitor them.

5 Getting real-time temperature data

  • File Name: task-check-cpu-temperature.xml
  • ID: no ID found

To obtain a snapshot of your current temperature, run the following command:

tux > sensors
[...]
Adapter: ACPI device
temp1:        +16.8°C  (crit = +18.8°C)
temp2:        +27.8°C  (crit = +119.0°C)
temp3:        +29.8°C  (crit = +119.0°C)

nvme-pci-0700
Adapter: PCI adapter
Composite:    +36.9°C  (low  = -273.1°C, high = +83.8°C)
                       (crit = +83.8°C)
Sensor 1:     +36.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +43.9°C  (low  = -273.1°C, high = +65261.8°C)

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +43.0°C  (high = +82.0°C, crit = +100.0°C)
Core 0:        +41.0°C  (high = +82.0°C, crit = +100.0°C)
Core 1:        +41.0°C  (high = +82.0°C, crit = +100.0°C)
Core 2:        +43.0°C  (high = +82.0°C, crit = +100.0°C)
Core 3:        +41.0°C  (high = +82.0°C, crit = +100.0°C)
Core 4:        +41.0°C  (high = +82.0°C, crit = +100.0°C)
Core 5:        +40.0°C  (high = +82.0°C, crit = +100.0°C)

Run the command below to monitor temperature in real time:

tux > watch sensors
Print this page