Featured image of post How to Check CPU and Motherboard Temperature on CentOS

How to Check CPU and Motherboard Temperature on CentOS

Monitoring system hardware status is an essential task in Linux server management, especially for CPU temperature, as it directly impacts the server's stability and performance...

In Linux server management, monitoring the hardware status of the system is a crucial task, particularly for CPU temperature, which directly affects the stability and performance of the server. As one of the widely used Linux distributions, CentOS provides various tools to help administrators monitor CPU temperature. This article will detail how to check the CPU temperature in CentOS, ensuring that your server operates at its best.

1. Install the lm_sensors Tool

First, you need to install the lm_sensors package, a powerful hardware monitoring tool that can read CPU temperature, fan speeds, and other related information.

Open a terminal and run the following command to install lm_sensors:

1
sudo yum install lm_sensors

For CentOS versions that use dnf, use the command:

1
sudo dnf install lm_sensors

2. Configure the Sensors

After installation, run the sensors-detect command to configure the sensors. During this process, the system will ask several questions, and you can typically answer “yes” to complete the configuration:

1
sudo sensors-detect

To automatically confirm all prompts, you can use:

1
sudo sh -c "yes | sensors-detect"

3. Check CPU Temperature

Once the configuration is complete, you can use the sensors command to view the CPU temperature and other hardware status:

1
sudo sensors

Sample Output

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
|  | acpitz-virtual-0 |
| --- | --- |
|  | Adapter: Virtual device |
|  | temp1:        +41.0°C  (crit = +95.0°C) |
|  |  |
|  | coretemp-isa-0000 |
|  | Adapter: Intel Core Processor |
|  | Package id: 0 |
|  | Core 0:       +42.0°C  (crit = +100.0°C) |
|  | Core 1:       +41.0°C  (crit = +100.0°C) |
|  | Core 2:       +40.0°C  (crit = +100.0°C) |
|  | Core 3:       +40.0°C  (crit = +100.0°C) |
|  | Note: temp1 refers to the motherboard temperature. Core 0, Core 1, Core 2, and Core 3 indicate the temperatures of the CPU cores. |

How to Check CPU and Motherboard Temperature on CentOS

4. Real-Time Monitoring of CPU Temperature

If you need to monitor CPU temperature in real-time, you can use the watch command in combination with sensors to regularly update the temperature information. For example, the following command updates the temperature data every 2 seconds:

1
watch -n 2 sensors

Important Notes

  • Ensure that your CPU and motherboard support temperature monitoring functionality.
  • If lm_sensors is unable to read the temperature information, it may be due to missing sensor hardware or driver support. In such cases, refer to the documentation related to your CPU and motherboard, or consider updating the BIOS and kernel to the latest versions.

By following the steps above, you can easily monitor the CPU temperature in your CentOS system, ensuring the stable operation of your server. Regularly checking the hardware status is key to preventing failures and improving system performance. If you encounter any issues, consider consulting relevant documentation or seeking help from the community.

Licensed under CC BY-NC-SA 4.0