centos

如何用centos cpustat监控CPU温度

小樊
40
2025-06-30 17:58:58
栏目: 智能运维

cpustat 是一个用于显示 CPU 使用情况的工具,它属于 sysstat 包。默认情况下,cpustat 不提供 CPU 温度监控功能。要监控 CPU 温度,你需要使用其他工具,如 lm-sensorswatch 命令。

首先,确保已经安装了 lm-sensors。在 CentOS 上,你可以使用以下命令安装:

sudo yum install lm-sensors

接下来,运行 sensors-detect 命令以检测系统中的传感器:

sudo sensors-detect

按照提示操作,通常情况下,你可以选择默认选项以自动检测传感器。

安装并配置好 lm-sensors 后,你可以使用 watch 命令结合 sensors 命令实时监控 CPU 温度。例如,要每秒刷新一次 CPU 温度信息,可以运行:

watch -n 1 sensors

这将显示类似于以下内容的输出:

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +45.0°C  (high = +80.0°C, crit = +98.0°C)
Core 0:        +42.0°C  (high = +80.0°C, crit = +98.0°C)
Core 1:        +43.0°C  (high = +80.0°C, crit = +98.0°C)
...

这里显示了每个核心的温度以及其他传感器的信息。请注意,具体的传感器名称和温度值可能因系统而异。

0
看了该问题的人还看了