CentOS安装lm_sensors温度监控

by admin on 2019年9月6日

CentOS安装lm_sensors温度监控

 

CentOS下监控CPU的温度

CentOS下监控CPU的温度。本文基于CentOS 6.5 64bit。

lm_sensors通过调用/lib/modules/2.6.32-358.xxx.x86_64/kernel/drivers/hwmon/coretemp.ko模块来读取温度值。

yum install lm_sensorssensors-detect           #一路YES即可modprobe i2c-devmobprobe coretemp        #必要cat /etc/sysconfig/lm_sensors    #查看温度监控模块sensors                  #查看CPU温度watch sensors            #每隔一秒显示CPU温度watch -n 1 -d sensors    #每隔一秒显示CPU温度

以下是一些无用内容,请自动忽略。
谷歌查到的一些其它监控CPU温度的内容:

/sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp
cat /proc/acpi/thermal_zone/THM0/temperature

On my 2010 Debian Lenny system, the path is:
proc/acpi/thermal_zone/THRM/temperature

CentOS下监控CPU的温度。本文基于CentOS 6.5 64bit。
lm_sensors通过调用/lib/modules/2.6.32-358.xxx.x86_64/kernel/drivers/hwmon/coretemp.ko模…

CentOS下nagios监控机房温度

图片 1

自己公司机房,空调用得烂,没有联动,没有通电自开机。经历过晚上电路切换拉闸事件。等知道的时候进去完全就一锅炉房。
曲线救国方式,用交换机的温度来判断空调是否断电。
1、expect交互登录交换机读取温度值

[[email protected] opt]# cat 123.exp#!/usr/bin/expect -fset user userset passwd passwordspawn telnet 192.168.0.254expect "Username:"send -- "$user\r"expect "Password:"send -- "$passwd\r"expect ""send -- "dis env\r"expect ""send -- "quit\r"expect eof

2、添加一个nagios监控脚本

[[email protected] opt]# cat /usr/local/nagios/libexec/check_temp#!/bin/bashexpect /opt/123.exp >/opt/123.logtemp=`awk '/hotspot/ {print $3}' /opt/123.log`STATE_OK=0STATE_WARNING=1STATE_CRITICAL=2STATE_UNKNOWN=3if [ "$#" == "4" ]then#Set variablesarg=${4}w=$2c=$4if [ $temp -ge $w -a $temp -lt $c ]thenecho "Warning :Room temperature $temp°C "exitstatus=$STATE_WARNINGelif [ $temp -ge $c ]thenecho "Critical :Room temperature $temp°C"exitstatus=$STATE_CRITICALelseecho "OK :Room temperature $temp°C."exitstatus=$STATE_OKfifiexit $exitstatus

3、添加command

[[email protected] opt]# tail -5 /usr/local/nagios/etc/objects/commands.cfg# 'check_temp' command definitiondefine command{command_name check_tempcommand_line $USER1$/check_temp -w $ARG1$ -c $ARG2$}

4、修改nrpe.cfg

[[email protected] opt]# grep "temp" /usr/local/nagios/etc/nrpe.cfgcommand[check_temp]=/usr/local/nagios/libexec/check_temp -w 30 -c 33

5、添加监控项目

[[email protected] opt]# tail -6 /usr/local/nagios/etc/objects/localhost.cfgdefine service{use generic-servicehost_name localhostservice_description check_tempcheck_command check_nrpe!check_temp}

<a
data-cke-saved-href=””
href=””
class=”cboxElement” rel=”example4″ 773″=”” style=”text-decoration: none;
color: rgb(1, 150, 227);”>
图片 2

自己公司机房,空调用得烂,没有联动,没有通电自开机。经历过晚上电路切换拉闸事件。等知道的时候进去完全…

CentOS
6.2下安装Cacti监控

 

先下载lm_sensors和sensors-applet两个程序。

1> 配置LAMP环境

CentOS 安装lm_sensors 温度监控

其中,lm_sensors找到了rpm包文件:lm_sensors-3.0.1-5.fc9.i386.rpm

a> 安装mysql数据库

首先查看是否安装,系统默认安装了    

可以看出是for
fc9的rpm包,由于fc和centos都属于redhat系列,所以应该可以安装。

yum -y install mysql mysql-server mysql-devel

#rpm -qa|grep sensors

下载页面: … 1/search/lm_sensors

b> 配置apache与php

lm_sensors-devel-3.1.1-17.el6.x86_64

其中有许多软件包,可供不同linux发行版选择安装。

yum -y install httpd php php-mysql

lm_sensors-libs-3.1.1-17.el6.x86_64

rpm包安装很简单,不多阐述,下载后双击即可,安装过程中可能会涉及到依赖问题,逐个安装即可。

2> 安装rrdtool和net-snmp

lm_sensors-3.1.1-17.el6.x86_64

安装后,运行sensors,如果出现no sensors
found的话,则要运行sensors-detect,一路回车默认安装即可,随后再运行sensors就能看出cpu电压温度等信息。

yum -y install zlib freetype libjpeg fontconfig gd libxml2 php-gd

 

接下来安装sensors-applet,此程序是sensors的图形界面。

yum -y install perl-Net-Daemon perl-PlRPC perl-DBI rrdtool 
perl-rrdtool  perl-DBD-MySQL

下载最新的sensors-detect

由于只有deb包,所以centos只能通过tar.gz源程序,需要编译安装。

yum -y install php-pdo lm_sensors net-snmp php-snmp net-snmp-utils

# cd /usr/sbin/

文件名:sensors-applet-2.2.1.tar.gz

3> 安装cacti

# rm -rf sensors-detect

下载页面:

tar -zxvf cacti-0.8.8a.tar.gz

# wget

下载后安装方法:

mv cacti-0.8.8a  /var/www/html/cacti/

–2013-10-16 10:54:28–
 

tar xzvf sensors-applet-2.2.1.tar.gz

图片 3

正在解析主机 dl.lm-sensors.org… 160.45.254.26

cd sensors-applet-2.2.1

正在连接 dl.lm-sensors.org|160.45.254.26|:80… 已连接。

./inconfigure –prefix /usr

已发出 HTTP 请求,正在等待回应… 200 OK

make

长度:202216 (197K) [text/plain]

make install

正在保存至: “sensors-detect”

安装过程中也会涉及到依赖问题,逐个安装即可。

 

安装完成后鼠标右键点击菜单兰,选择“添加到面板”,选择“Hardware Sensors
Monitor”即可在菜单兰上显示cpu温度。

100%[======================================>] 202,216      163K/s  
in 1.2s

其中,lm_sensors找到了rpm包文件:lm_sensors-3.0.1-5.fc9.i386.rpm
可以看出是for fc9的rpm包,由于fc和centos都属…

 

2013-10-16 10:54:30 (163 KB/s) – 已保存 “sensors-detect”
[202216/202216])

给予权限:

# chmod 755 sensors-detect

安装coretemp:

#wget

#rpm -ivh kmod-coretemp-1.1-2.el5.x86_64.rpm

   Preparing…              
 ###########################################
[100%]

   1:kmod-coretemp        
 ###########################################
[100%]

需要安装dkms,安装:

#yum install dkms

安装好后,

# modinfo coretemp

# modprobe coretemp

# lsmod|grep coretemp

coretemp                7381  0

最后运行sensors

#sensors-detect

01

# sensors-detect revision 6203 (2013-10-09 17:58:33 +0200)

02

# System: VMware, Inc. VMware Virtual Platform [None]

03

# Board: Intel Corporation 440BX Desktop Reference Platform

04

 

05

This program will help you determine which kernel modules you need

06

to load to use lm_sensors most effectively. It is generally safe

07

and recommended to accept the default answers to all questions,

08

unless you know what you’re doing.

09

 

10

Some south bridges, CPUs or memory controllers contain embedded sensors.

11

Do you want to scan for them? This is totally safe. (YES/no): yes

12

Silicon Integrated Systems SIS5595…                       No

13

VIA VT82C686 Integrated Sensors…                          No

14

VIA VT8231 Integrated Sensors…                            No

15

AMD K8 thermal sensors…                                   No

16

AMD Family 10h thermal sensors…                           No

17

AMD Family 11h thermal sensors…                           No

18

AMD Family 12h and 14h thermal sensors…                   No

19

AMD Family 15h thermal sensors…                           No

20

AMD Family 15h power sensors…                             No

21

AMD Family 16h power sensors…                             No

22

Intel digital thermal sensor…                             Success!

23

    (driver `coretemp’)

24

Intel AMB FB-DIMM thermal sensor…                         No

25

VIA C7 thermal sensor…                                    No

26

VIA Nano thermal sensor…                                  No

27

 

28

Some Super I/O chips contain embedded sensors. We have to write to

29

standard I/O ports to probe them. This is usually safe.

30

Do you want to scan for Super I/O sensors? (YES/no): yes

31

Probing for Super-I/O at 0x2e/0x2f

32

Trying family `National Semiconductor/ITE’…               Yes

33

Found unknown chip with ID 0x0f00

34

Probing for Super-I/O at 0x4e/0x4f

35

Trying family `National Semiconductor/ITE’…               No

36

Trying family `SMSC’…                                     No

37

Trying family `VIA/Winbond/Nuvoton/Fintek’…               No

38

Trying family `ITE’…                                      No

39

 

40

Some systems (mainly servers) implement IPMI, a set of common interfaces

41

through which system health data may be retrieved, amongst other things.

42

We first try to get the information from SMBIOS. If we don’t find it

43

there, we have to read from arbitrary I/O ports to probe for such

44

interfaces. This is normally safe. Do you want to scan for IPMI

45

interfaces? (YES/no): yes

46

Probing for `IPMI BMC KCS’ at 0xca0…                      No

47

Probing for `IPMI BMC SMIC’ at 0xca8…                     No

48

 

49

Some hardware monitoring chips are accessible through the ISA I/O ports.

50

We have to write to arbitrary I/O ports to probe them. This is usually

51

safe though. Yes, you do have ISA I/O ports even if you do not have any

52

ISA slots! Do you want to scan the ISA I/O ports? (YES/no): yes

53

Probing for `National Semiconductor LM78′ at 0x290…       No

54

Probing for `National Semiconductor LM79′ at 0x290…       No

55

Probing for `Winbond W83781D’ at 0x290…                   No

56

Probing for `Winbond W83782D’ at 0x290…                   No

57

 

58

Lastly, we can probe the I2C/SMBus adapters for connected hardware

59

monitoring devices. This is the most risky part, and while it works

60

reasonably well on most systems, it has been reported to cause trouble

61

on some systems.

62

Do you want to probe the I2C/SMBus adapters now? (YES/no): yes

63

Using driver `i2c-piix4′ for device 0000:00:07.3: Intel 82371AB PIIX4
ACPI

64

Module i2c-dev loaded successfully.

65

 

66

 

67

Now follows a summary of the probes I have just done.

68

Just press ENTER to continue:

69

 

70

Driver `coretemp’:

71

  * Chip `Intel digital thermal sensor’ (confidence: 9)

72

 

73

Do you want to overwrite /etc/sysconfig/lm_sensors? (YES/no): yes

74

Starting lm_sensors: loading module coretemp               [确定]

全部选yes然后最后看到loading module coretemp               [确定] 

及说明启动成功! 

#sensors 

查看温度监控

CentOS
安装lm_sensors 温度监控 首先查看是否安装,系统默认安装了 #rpm -qa|grep
sensors lm_sensors-devel-3.1.1-17.el6.x86_64…

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图