【Linux简单实用小命令033】温度检测:lm-sensors

Scroll Down

lm-sensors可以获得主板,CPU工作电压、温度、风扇转速等信息。

大多数现代主板都包含某种形式的硬件监视芯片。

这些芯片读取诸如芯片温度,风扇转速和电压电平。

有很多不同的芯片可以由主板制造商获得大致相同的结果。

github 地址:https://github.com/groeck/lm-sensors

操作系统:CentOS 7.9

[root@yaomm sbin]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)

安装温度检测软件:lm-sensors

yum install lm_sensors

监测所有能监测的温度传感器

sh -c "yes|sensors-detect"

安装过程:

[root@yaomm sbin]# sh -c "yes|sensors-detect"
# sensors-detect revision 3.4.0-8 (2016-06-01)
# System: Default string Default string [Default string]
# Kernel: 3.10.0-1160.el7.x86_64 x86_64
# Processor: Intel(R) Celeron(R) CPU J1900 @ 1.99GHz (6/55/9)

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): Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No

……
……
……

Driver `nct6775':
  * ISA bus, address 0xa20
    Chip `Nuvoton NCT6102D/NCT6104D/NCT6106D Super IO Sensors' (confidence: 9)

Do you want to overwrite /etc/sysconfig/lm_sensors? (YES/no): Unloading i2c-dev... OK

***************************************************************
Warning: the preferred way to run this script non-interactively
is with option --auto. Other methods are discouraged and may
stop working at some point in the future.
***************************************************************

使用命令sensors检测CPU温度

[root@yaomm sbin]# sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +30.0°C  (high = +105.0°C, crit = +105.0°C)
Core 1:       +30.0°C  (high = +105.0°C, crit = +105.0°C)
Core 2:       +32.0°C  (high = +105.0°C, crit = +105.0°C)
Core 3:       +32.0°C  (high = +105.0°C, crit = +105.0°C)

长时间监控,使用watch命令,每两秒刷新一次

[root@yaomm yaomm]# watch sensors

Every 2.0s: sensors                                                                Thu Dec 24 17:26:42 2020

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +31.0°C  (high = +105.0°C, crit = +105.0°C)
Core 1:       +31.0°C  (high = +105.0°C, crit = +105.0°C)
Core 2:       +33.0°C  (high = +105.0°C, crit = +105.0°C)
Core 3:       +33.0°C  (high = +105.0°C, crit = +105.0°C)

扩展

基于lm-sensors的图形控制台工具

参考文档

1、Centos 7. 6 Install lm_sensors
https://blog.csdn.net/hanzheng260561728/article/details/97011084

2、CentOS安装并查看lm_sensors
https://www.cnblogs.com/jiawenhuangzi/p/13845360.html

3、lm_sensors for archLinux
https://wiki.archlinux.org/index.php/Lm_sensors_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)