如何查看 CentOS 7 和 RedHat Enterprise Linux 7 上的 CPU 温度
我是 CentOS 7 服务器的新系统管理员。如何在 CentOS Linux 7/8 或 Red Hat Enterprise Linux 7/8 服务器上获取 CPU 温度信息?如何在搭载 CentOS Linux 7 桌面操作系统的笔记本电脑上读取 CPU 温度?
您需要安装名为 lm_sensor 的 Linux 硬件监控工具。此工具提供了一些必要的命令行实用程序,用于监控 Linux 系统的硬件健康状况,其中包括硬件健康状况监控硬件(包括 CPU 和风扇速度)。以下说明适用于 CentOS/RHEL 版本 7 和 8。
您需要安装名为 lm_sensor 的 Linux 硬件监控工具。此工具提供了一些必要的命令行实用程序,用于监控 Linux 系统的硬件健康状况,其中包括硬件健康状况监控硬件(包括 CPU 和风扇速度)。以下说明适用于 CentOS/RHEL 版本 7 和 8。
教程详细信息 | |
---|---|
难度等级 | 简单的 |
Root 权限 | 是的 |
要求 | Linux 终端 |
类别 | 系统管理 |
先决条件 | CentOS/RHEL 7 |
操作系统兼容性 | Alma • CentOS • RHEL • Rocky • Stream |
预计阅读时间 | 4 分钟 |
找出你的操作系统版本
键入以下cat 命令:
$ cat /etc/centos-release
或
$ cat /etc/redhat-release
示例输出:
CentOS Linux release 7.2.1511 (Core)
在 CentOS 或 RHEL 7/8 上安装 lm_sensors 包
键入以下yum 命令或 dnf 命令:
$ sudo yum install lm_sensors
如何配置 lm_sensors
键入以下命令并对所有提示都说“是”:
$ sudo sensors-detect
示例输出:
# sensors-detect revision 6170 (2013-05-20 21:25:22 +0200) # System: ADI Engineering RCC-VE [1.0] 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 15h power sensors... No AMD Family 16h power sensors... No Intel digital thermal sensor... Success! (driver `coretemp') Intel AMB FB-DIMM 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 Probing for `Maxim MAX6639'... No Probing for `Analog Devices ADM1029'... No Probing for `ITE IT8712F'... No Probing for `Fintek custom power control IC'... No Probing for `Winbond W83791SD'... No Client found at address 0x50 Probing for `Analog Devices ADM1033'... No Probing for `Analog Devices ADM1034'... No Probing for `SPD EEPROM'... Yes (confidence 8, not a hardware monitoring chip) Probing for `EDID EEPROM'... No 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
如何在 CentOS/RHEL 7 Linux 上获取 CPU 温度信息
键入以下命令:
$ sensors
示例输出:
coretemp-isa-0000 Adapter: ISA adapter Core 0: +48.0°C (high = +98.0°C, crit = +98.0°C) Core 1: +48.0°C (high = +98.0°C, crit = +98.0°C) Core 2: +48.0°C (high = +98.0°C, crit = +98.0°C) Core 3: +47.0°C (high = +98.0°C, crit = +98.0°C)
您可以运行以下监视命令来查看屏幕上的数据:
$ watch sensors
Gif.01:传感器命令实际运行
如何在 CentOS/RHEL 7 Linux 上获取硬盘温度信息?
您始终可以安装hddtemp 命令来读取 CentOS/RHEL 7 上的硬盘温度:
$ hddtemp
示例输出:
/dev/sda: Samsung SSD 850 EVO mSATA 500GB: 45°C /dev/sdb: WDC WDS500G1B0A-00H9H0: 42°C /dev/sdc: WDC WDS500G1B0A-00H9H0: 42°C /dev/sdd: WDC WDS500G1B0A-00H9H0: 40°C /dev/sde: WDC WDS500G1B0A-00H9H0: 39°C
结论
您学习了如何使用命令行选项在 CentOS 和 RHEL 版本 7/8 上查找 CPU 和硬盘/SSD 温度。使用 man 命令(或传递 --help 选项)阅读以下手册页:
$ man sensors
$ man watch