利用DELL的OMSA监控服务器的温度
2013-04-19 11:01
295 查看
服务器换机房以后就涉及到需要对服务器做完整的监控,对服务器温度的监控是一个重要的监控,由服务器的温度可以得知服务器的散热情况是否有问题以及机房的空调是否OK。比如服务器风扇坏了会导致服务器的温度升高,那么我们就可以很快地发现并解决。
在网上找到一个工具lm_sensors,很多网友用这个工具来做监控,但是因为我的linux内核版本为2.6.18-194.el5,lm_sensors在该内核版本不支持我的E5504的CPU。总是报Unknown CPU model。只能升级内核版本,对于线上服务器危险系数比较高,因此只有另辟蹊径,咨询DELL的技术人员以后获悉DELL的OMSA(Dell OpenManage Server Administrator)能获得机箱的温度,OMSA是DELL提供的一组集成管理服务,可以对本地和远程的服务器进行管理和监控。
接下来就来描述如何通过OMSA获取服务器的温度,并通过cacti和nagios来进行监控。
1. 安装和使用OMSA 6.5 (centos5.5_64bit)
A. 安装OMSA 6.5
wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
yum install -y srvadmin-base
yum install -y srvadmin-storageservices
B. 禁用OMSA自带的snmp功能
/opt/dell/srvadmin/sbin/dcecfg command=disablesnmp
C. 启动OMSA
/opt/dell/srvadmin/sbin/srvadmin-services.sh start
D. 获取温度的命令
/opt/dell/srvadmin/sbin/omreport chassis temps
2. 使用cacti监控系统温度
下面是使用cacti来调用OMSA监控系统温度的脚本
cat /etc/snmp/monitor_tem_cacti.sh
#!/bin/bash
#Purpose: Monitor the classis's temperature -----cacti
#Author: 飞鸿无痕
#Date: 2012-09-07
#define the path for the executable file
TEMPPATH='/opt/dell/srvadmin/sbin'
#use del omreport tool to get the classis's temperature
TEMP=`$TEMPPATH/omreport chassis temps | grep "Reading" | awk '{print $3}'`
echo $TEMP
脚本内容保存以后还需要更改/etc/snmp/snmpd.conf配置文件,添加如下一行:
extend .1.3.6.1.4.1.2021.25 monitor_temperature /bin/bash /etc/snmp/monitor_tem_cacti.sh
然后重启snmp服务
/etc/rc.d/init.d/snmpd restart
然后直接在cacti端添加数据模板、图形模板然后添加到主机中就可以了,附件附上自己监控的cacti图形模板。
3. 使用Nagios监控系统温度
下面是使用nagios调用OMSA监控系统温度的脚本
cat /usr/local/nagios/libexec/monitor_tem_nagios.sh
#!/bin/bash
#Purpose: Monitor the classis's temperature -----nagios
#Author: 飞鸿无痕
#Date: 2012-09-07
#Status OK: the temperature greater than or equal 8 and less than or equal 42
#define the exist status
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
#define the path for the executable file
TEMPPATH='/opt/dell/srvadmin/sbin'
#use del omreport tool to get the classis's temperature
TEMP=`$TEMPPATH/omreport chassis temps | grep "Reading" |awk -F'[ .]+' '{print $3}'`
if [ $? -ne 0 ];then
echo "Please Check the temperature Plugins"
exit $STATE_UNKNOWN
fi
if [ "$TEMP" -ge 8 -a "$TEMP" -le 42 ];then
echo "Check OK,The classis's temperature is: $TEMP"
exit $STATE_OK
elif [ "$TEMP" -ge 3 -a "$TEMP" -lt 8 -o "$TEMP" -gt 42 -a "$TEMP" -lt 47 ];then
echo "Check WARNING,The classis's temperature is: $TEMP"
exit $STATE_WARNING
else
echo "Check Critical,The classis's temperature is: $TEMP"
exit $STATE_CRITICAL
fi
这个脚本会在系统的温度小于8度或者高于47度的时候自动通过nagios报警。设置完这个脚本还需要更改/usr/local/nagios/etc/nrpe.cfg配置文件,添加如下内容:
command[check_temperature]=/usr/local/nagios/libexec/monitor_tem_nagios.sh
然后在nagios服务器端添加check_temperature的监控即可。
4. 自动配置cacti和nagios使用OMSA监控系统温度脚本
将上面的cacti和nagio监控的脚本保存到和下面的脚本在一个目录下,不要更改脚本的名字。使用下面的脚本安装完成OMSA后会自动配置cacti和nagios。
cat monitor_tem_install.sh
#!/bin/bash
#Purpose: install Dell OpenManage Server Administrator tool(OMSA) and configure cacti and nagios client
#Author: 飞鸿无痕
#Date: 2012-09-07
#download the file and install
wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
yum install -y srvadmin-base srvadmin-storageservices
#disable the omsa's snmp
/opt/dell/srvadmin/sbin/dcecfg command=disablesnmp
#start amsa
/opt/dell/srvadmin/sbin/srvadmin-services.sh start
#add monitor script to snmp directory
cp monitor_tem_cacti.sh /etc/snmp/
chmod +x /etc/snmp/monitor_tem_cacti.sh
echo "extend .1.3.6.1.4.1.2021.25 monitor_temperature /bin/bash /etc/snmp/monitor_tem_cacti.sh" >> /etc/snmp/snmpd.conf
/etc/rc.d/init.d/snmpd restart
#add monitor script to nagios directory
cp monitor_tem_nagios.sh /usr/local/nagios/libexec/
echo "command[check_temperature]=/usr/local/nagios/libexec/monitor_tem_nagios.sh" >> /usr/local/nagios/etc/nrpe.cfg
kill -9 $(ps -ef | grep nrpe | grep -v grep | awk '{print $2}')
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
监控系统温度的cacti模板:
http://down.51cto.com/data/756245
安装和部署OMSA监控温度的脚本:
http://down.51cto.com/data/756252
在网上找到一个工具lm_sensors,很多网友用这个工具来做监控,但是因为我的linux内核版本为2.6.18-194.el5,lm_sensors在该内核版本不支持我的E5504的CPU。总是报Unknown CPU model。只能升级内核版本,对于线上服务器危险系数比较高,因此只有另辟蹊径,咨询DELL的技术人员以后获悉DELL的OMSA(Dell OpenManage Server Administrator)能获得机箱的温度,OMSA是DELL提供的一组集成管理服务,可以对本地和远程的服务器进行管理和监控。
接下来就来描述如何通过OMSA获取服务器的温度,并通过cacti和nagios来进行监控。
1. 安装和使用OMSA 6.5 (centos5.5_64bit)
A. 安装OMSA 6.5
wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
yum install -y srvadmin-base
yum install -y srvadmin-storageservices
B. 禁用OMSA自带的snmp功能
/opt/dell/srvadmin/sbin/dcecfg command=disablesnmp
C. 启动OMSA
/opt/dell/srvadmin/sbin/srvadmin-services.sh start
D. 获取温度的命令
/opt/dell/srvadmin/sbin/omreport chassis temps
2. 使用cacti监控系统温度
下面是使用cacti来调用OMSA监控系统温度的脚本
cat /etc/snmp/monitor_tem_cacti.sh
#!/bin/bash
#Purpose: Monitor the classis's temperature -----cacti
#Author: 飞鸿无痕
#Date: 2012-09-07
#define the path for the executable file
TEMPPATH='/opt/dell/srvadmin/sbin'
#use del omreport tool to get the classis's temperature
TEMP=`$TEMPPATH/omreport chassis temps | grep "Reading" | awk '{print $3}'`
echo $TEMP
脚本内容保存以后还需要更改/etc/snmp/snmpd.conf配置文件,添加如下一行:
extend .1.3.6.1.4.1.2021.25 monitor_temperature /bin/bash /etc/snmp/monitor_tem_cacti.sh
然后重启snmp服务
/etc/rc.d/init.d/snmpd restart
然后直接在cacti端添加数据模板、图形模板然后添加到主机中就可以了,附件附上自己监控的cacti图形模板。
3. 使用Nagios监控系统温度
下面是使用nagios调用OMSA监控系统温度的脚本
cat /usr/local/nagios/libexec/monitor_tem_nagios.sh
#!/bin/bash
#Purpose: Monitor the classis's temperature -----nagios
#Author: 飞鸿无痕
#Date: 2012-09-07
#Status OK: the temperature greater than or equal 8 and less than or equal 42
#define the exist status
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
#define the path for the executable file
TEMPPATH='/opt/dell/srvadmin/sbin'
#use del omreport tool to get the classis's temperature
TEMP=`$TEMPPATH/omreport chassis temps | grep "Reading" |awk -F'[ .]+' '{print $3}'`
if [ $? -ne 0 ];then
echo "Please Check the temperature Plugins"
exit $STATE_UNKNOWN
fi
if [ "$TEMP" -ge 8 -a "$TEMP" -le 42 ];then
echo "Check OK,The classis's temperature is: $TEMP"
exit $STATE_OK
elif [ "$TEMP" -ge 3 -a "$TEMP" -lt 8 -o "$TEMP" -gt 42 -a "$TEMP" -lt 47 ];then
echo "Check WARNING,The classis's temperature is: $TEMP"
exit $STATE_WARNING
else
echo "Check Critical,The classis's temperature is: $TEMP"
exit $STATE_CRITICAL
fi
这个脚本会在系统的温度小于8度或者高于47度的时候自动通过nagios报警。设置完这个脚本还需要更改/usr/local/nagios/etc/nrpe.cfg配置文件,添加如下内容:
command[check_temperature]=/usr/local/nagios/libexec/monitor_tem_nagios.sh
然后在nagios服务器端添加check_temperature的监控即可。
4. 自动配置cacti和nagios使用OMSA监控系统温度脚本
将上面的cacti和nagio监控的脚本保存到和下面的脚本在一个目录下,不要更改脚本的名字。使用下面的脚本安装完成OMSA后会自动配置cacti和nagios。
cat monitor_tem_install.sh
#!/bin/bash
#Purpose: install Dell OpenManage Server Administrator tool(OMSA) and configure cacti and nagios client
#Author: 飞鸿无痕
#Date: 2012-09-07
#download the file and install
wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
yum install -y srvadmin-base srvadmin-storageservices
#disable the omsa's snmp
/opt/dell/srvadmin/sbin/dcecfg command=disablesnmp
#start amsa
/opt/dell/srvadmin/sbin/srvadmin-services.sh start
#add monitor script to snmp directory
cp monitor_tem_cacti.sh /etc/snmp/
chmod +x /etc/snmp/monitor_tem_cacti.sh
echo "extend .1.3.6.1.4.1.2021.25 monitor_temperature /bin/bash /etc/snmp/monitor_tem_cacti.sh" >> /etc/snmp/snmpd.conf
/etc/rc.d/init.d/snmpd restart
#add monitor script to nagios directory
cp monitor_tem_nagios.sh /usr/local/nagios/libexec/
echo "command[check_temperature]=/usr/local/nagios/libexec/monitor_tem_nagios.sh" >> /usr/local/nagios/etc/nrpe.cfg
kill -9 $(ps -ef | grep nrpe | grep -v grep | awk '{print $2}')
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
监控系统温度的cacti模板:
http://down.51cto.com/data/756245
安装和部署OMSA监控温度的脚本:
http://down.51cto.com/data/756252
相关文章推荐
- 利用DELL的OMSA监控服务器的温度
- 利用DELL的OMSA监控服务器的温度
- 利用DELL的OMSA监控服务器的温度
- 利用OpenIPMI监控服务器温度
- 利用OpenIPMI监控服务器温度
- Zabbix基于Dell系统管理OMSA监控物理服务器硬件
- 利用 lm_sensors 套件监控服务器温度,电压
- RH442-1 利用snmp和mrtg监控linux服务器的网络流量
- 利用nagios搭建打印机监控服务器
- 通过ipmitool监控机房内服务器温度
- 服务器硬件监控之OMSA
- dell物理服务器硬件磁盘监控
- 4006.Cacti集监控IBM刀片服务器温度和风扇运行状态
- dell poweredge系列服务器的监控
- Dell 服务器 安装ITA (OME)客户端 OMSA
- Linux下利用nc命令来监控检测服务器的端口使用情况
- Linux下利用nc命令来监控检测服务器的端口使用情况
- Linux利用nc命令监控服务器端口的方法
- 利用SQL 2005 系统表监控管理SQL服务器运行情况
- DELL OME监控服务器安装配置