Linux系统之温度监控工具——lm_sensors的安装和基本使用

简介: Linux系统之温度监控工具——lm_sensors的安装和基本使用

一、lm_sensors介绍

lm_sensors,是一款基于linux系统的硬件监控的软件。可以监控主板,CPU的工作电压,温度等数据。

二、检测安装环境

1.检查yum仓库

[root@192 ~]# yum repolist all |grep enable
base/7/x86_64               CentOS-7 - Base - mirrors.aliyun.com enabled: 10,072
epel/x86_64                 Extra Packages for Enterprise Linux  enabled: 13,758
extras/7/x86_64             CentOS-7 - Extras - mirrors.aliyun.c enabled:    512
updates/7/x86_64            CentOS-7 - Updates - mirrors.aliyun. enabled:  4,088

2.检查系统版本

[root@server data]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

三、安装lm_sensors

[root@192 ~]# yum install lm_sensors -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                    | 3.6 kB  00:00:00     
epel                                                                                                                                                    | 4.7 kB  00:00:00     
extras                                                                                                                                                  | 2.9 kB  00:00:00     
updates                                                                                                                                                 | 2.9 kB  00:00:00     
(1/3): epel/x86_64/updateinfo                                                                                                                           | 1.1 MB  00:00:00     
(2/3): epel/x86_64/primary_db                                                                                                                           | 7.0 MB  00:00:04     
(3/3): updates/7/x86_64/primary_db                                                                                                                      |  16 MB  00:00:10     
Resolving Dependencies
--> Running transaction check
---> Package lm_sensors.x86_64 0:3.4.0-8.20160601gitf9185e5.el7 will be installed
--> Processing Dependency: lm_sensors-libs = 3.4.0-8.20160601gitf9185e5.el7 for package: lm_sensors-3.4.0-8.20160601gitf9185e5.el7.x86_64
--> Running transaction check
---> Package lm_sensors-libs.x86_64 0:3.4.0-6.20160601gitf9185e5.el7 will be updated
---> Package lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================
 Package                                    Arch                              Version                                                    Repository                       Size
===============================================================================================================================================================================
Installing:
 lm_sensors                                 x86_64                            3.4.0-8.20160601gitf9185e5.el7                             base                            141 k
Updating for dependencies:
 lm_sensors-libs                            x86_64                            3.4.0-8.20160601gitf9185e5.el7                             base                             42 k

Transaction Summary
===============================================================================================================================================================================
Install  1 Package
Upgrade             ( 1 Dependent package)

Total download size: 182 k
Downloading packages:
No Presto metadata available for base
(1/2): lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64.rpm                                                                                        |  42 kB  00:00:00     
(2/2): lm_sensors-3.4.0-8.20160601gitf9185e5.el7.x86_64.rpm                                                                                             | 141 kB  00:00:00     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                          734 kB/s | 182 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64                                                                                                       1/3 
  Installing : lm_sensors-3.4.0-8.20160601gitf9185e5.el7.x86_64                                                                                                            2/3 
  Cleanup    : lm_sensors-libs-3.4.0-6.20160601gitf9185e5.el7.x86_64                                                                                                       3/3 
  Verifying  : lm_sensors-3.4.0-8.20160601gitf9185e5.el7.x86_64                                                                                                            1/3 
  Verifying  : lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64                                                                                                       2/3 
  Verifying  : lm_sensors-libs-3.4.0-6.20160601gitf9185e5.el7.x86_64                                                                                                       3/3 

Installed:
  lm_sensors.x86_64 0:3.4.0-8.20160601gitf9185e5.el7                                                                                                                           

Dependency Updated:
  lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7                                                                                                                      

Complete!

四、侦测硬件

[root@server data]# sensors-detect 
# sensors-detect revision 3.4.0-8 (2016-06-01)
# System: onebot Mini [Default string]
# Board: Default string Default string
# Kernel: 3.10.0-957.el7.x86_64 x86_64
# Processor: Intel(R) Celeron(R) N5095 @ 2.00GHz (6/156/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 16h thermal sensors...                           No
AMD Family 17h 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
Intel 5500/5520/X58 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 Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      Yes
Found unknown chip with ID 0x8613
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      No

Some systems (mainly servers) implement IPMI, a set of common interfaces
through which system health data may be retrieved, amongst other things.
We first try to get the information from SMBIOS. If we don't find it
there, we have to read from arbitrary I/O ports to probe for such
interfaces. This is normally safe. Do you want to scan for IPMI
interfaces? (YES/no): yes
Probing for `IPMI BMC KCS' at 0xca0...                      No
Probing for `IPMI BMC SMIC' at 0xca8...                     No

Some hardware monitoring chips are accessible through the ISA I/O ports.
We have to write to arbitrary I/O ports to probe them. This is usually
safe though. Yes, you do have ISA I/O ports even if you do not have any
ISA slots! Do you want to scan the ISA I/O ports? (YES/no): yes
Probing for `National Semiconductor LM78' at 0x290...       No
Probing for `National Semiconductor LM79' at 0x290...       No
Probing for `Winbond W83781D' at 0x290...                   No
Probing for `Winbond W83782D' at 0x290...                   No

Lastly, we can probe the I2C/SMBus adapters for connected hardware
monitoring devices. This is the most risky part, and while it works
reasonably well on most systems, it has been reported to cause trouble
on some systems.
Do you want to probe the I2C/SMBus adapters now? (YES/no): yes
Found unknown SMBus adapter 8086:4da3 at 0000:00:1f.4.
Sorry, no supported PCI bus adapters found.
Module i2c-dev loaded successfully.


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

五、查看温度

[root@server data]# 
[root@server data]# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +27.8°C  (crit = +119.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +53.0°C  (high = +105.0°C, crit = +105.0°C)
Core 0:         +48.0°C  (high = +105.0°C, crit = +105.0°C)
Core 1:         +48.0°C  (high = +105.0°C, crit = +105.0°C)
Core 2:         +48.0°C  (high = +105.0°C, crit = +105.0°C)
Core 3:         +48.0°C  (high = +105.0°C, crit = +105.0°C)

iwlwifi-virtual-0
Adapter: Virtual device
temp1:            N/A

六、动态监控温度


[root@server data]# watch sensors

在这里插入图片描述

相关实践学习
CentOS 7迁移Anolis OS 7
龙蜥操作系统Anolis OS的体验。Anolis OS 7生态上和依赖管理上保持跟CentOS 7.x兼容,一键式迁移脚本centos2anolis.py。本文为您介绍如何通过AOMS迁移工具实现CentOS 7.x到Anolis OS 7的迁移。
相关文章
|
6天前
|
Linux 应用服务中间件 Shell
linux系统服务二!
本文详细介绍了Linux系统的启动流程,包括CentOS 7的具体启动步骤,从BIOS自检到加载内核、启动systemd程序等。同时,文章还对比了CentOS 6和CentOS 7的启动流程,分析了启动过程中的耗时情况。接着,文章讲解了Linux的运行级别及其管理命令,systemd的基本概念、优势及常用命令,并提供了自定义systemd启动文件的示例。最后,文章介绍了单用户模式和救援模式的使用方法,包括如何找回忘记的密码和修复启动故障。
23 5
linux系统服务二!
|
6天前
|
Linux 应用服务中间件 Shell
linux系统服务!!!
本文详细介绍了Linux系统(以CentOS7为例)的启动流程,包括BIOS自检、读取MBR信息、加载Grub菜单、加载内核及驱动程序、启动systemd程序加载必要文件等五个主要步骤。同时,文章还对比了CentOS6和CentOS7的启动流程图,并分析了启动流程的耗时。此外,文中还讲解了Linux的运行级别、systemd的基本概念及其优势,以及如何使用systemd管理服务。最后,文章提供了单用户模式和救援模式的实战案例,帮助读者理解如何在系统启动出现问题时进行修复。
24 3
linux系统服务!!!
|
6天前
|
网络协议 Linux
linux系统重要文件目录
本文介绍了Linux系统中的重要目录及其历史背景,包括根目录、/usr、/etc、/var/log和/proc等目录的结构和功能。其中,/etc目录下包含了许多关键配置文件,如网卡配置、DNS解析、主机名设置等。文章还详细解释了各目录和文件的作用,帮助读者更好地理解和管理Linux系统。
23 2
|
7天前
|
Ubuntu Linux Shell
Linux 系统中的代码类型或脚本类型内容
在 Linux 系统中,代码类型多样,包括 Shell 脚本、配置文件、网络配置、命令行工具和 Cron 定时任务。这些代码类型广泛应用于系统管理、自动化操作、网络配置和定期任务,掌握它们能显著提高系统管理和开发的效率。
|
9天前
|
缓存 监控 Linux
Linux性能分析利器:全面掌握perf工具
【10月更文挑战第18天】 在Linux系统中,性能分析是确保软件运行效率的关键步骤。`perf`工具,作为Linux内核自带的性能分析工具,为开发者提供了强大的性能监控和分析能力。本文将全面介绍`perf`工具的使用,帮助你成为性能优化的高手。
43 1
|
9天前
|
缓存 监控 Linux
掌握Linux性能分析:深入探索perf工具
【10月更文挑战第26天】
14 1
|
10天前
|
关系型数据库 MySQL Linux
Linux系统如何设置自启动服务在MySQL数据库启动后执行?
【10月更文挑战第25天】Linux系统如何设置自启动服务在MySQL数据库启动后执行?
57 3
|
2天前
|
关系型数据库 MySQL Linux
Linux-安装Mariadb
本文介绍了在 Alibaba Cloud Linux 系统上安装和配置 MariaDB 10.5 的步骤。包括下载安装、初始化数据库、启动服务、处理启动失败的常见问题(如权限问题),以及如何连接数据库、设置密码和允许外部连接。通过这些步骤,您可以顺利完成 MariaDB 的安装和基本配置。
12 0
|
关系型数据库 MySQL Linux
linux 的实用工具分享
做开发用Linux感觉比Windows在一些地方要好用(只是个人感觉,不想引战),在Linux中没有烦人的广告弹窗,没有动不动给你惊喜的Windows强制更新,而且Linux相对Windows要流畅,在低配的电脑上也很少卡顿.现在很多开发软件都有Linux版本,使用起来也算方便.当然,要是玩游戏等娱乐使用,还是Windows牛逼.我现在写代码基本都使用Linux.我用的Ubuntu18.04。
2063 0