Nagios监控HP硬件状态

一,监控思想

可以使用两种模式,check_nrpe方式和SNMP方式,这里我们采用SNMP代理方式。

两种方式都依赖HP的ProLiantSupportPack(PSP)软件包,有两种方式安装PSP包,一种tar包,一种RPM包,经过实践tar包很难安装,所以最终采用rpm包方式。

二,实施步骤

1,到http://downloads.linux.hp.com/SDR/getting_started.html下载add_repo.sh脚本,并上传到HP服务器。

2,用root用户登录,在服务器上执行以下命令:

chmod700add_repo.sh

./add_repo.shspp-drhel-r6Server-yhp.repo

(运行该脚本后会在/etc/yum.repos.d/生成一个hp.repo文件,

-dlinux的发行版本,如rhel、centos,

-rlinux版本,如6server,

-y指定yum客户端的配置文件的名称,如hp.repo)

yum-yinstallhp-healthhpacuclihp-smh-templateshpacucli

3,我们先命令行检测下:

hpacuclictrlallshowconfig

hpacuclictrlslot=0showconfigdetail(阵列详细信息)

上面命令执行正确,会出现以下信息:

4,修改snmpd.conf配置文件,在文件最后加上以下内容,并修改公共字符串。

vi/etc/snmp/snmpd.conf

#FollowingentrieswereaddedbyHPInsightManagementAgentsat

dlmodcmaX/usr/lib64/libcmaX64.so

rwcommunityhp127.0.0.1

rocommunitysou_shi0.0.0.0

rwcommunitysou_shi127.0.0.1

rocommunitysou_shidefault-Vsystemonly

trapcommunityhp

trapsinklocalhostsou_shi

5,重新启动SNMP服务

/etc/init.d/snmpdrestart

6,启动HP检测服务

/etc/init.d/hp-snmp-agentsstart

/etc/init.d/hp-healthstart

7,安装nagios服务端监控

在nagios服务器端安装check_hpasm-4.6.3.tar.gz,软件下载地址如下:http://labs.consol.de/lang/en/nagios/check_hpasm/

tar-zxvfcheck_hpasm-4.6.3.tar.gz

./configure--prefix=/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios--with-degrees=celsius--enable-hpacucli--enable-hwinfo--enable-extendedinfo--enable-perfdata

make&&makeinstall

先用命令行进行测试:

/usr/local/nagios/libexec/check_hpasm--hostname192.168.1.224-Csou_shi

如果命令行正确,会出现下面的信息:

8,修改nagios配置文件

commands.cfg内容如下:

##############################hp_monitor########################

definecommand{

command_namecheck_hp_hardware

command_line/usr/local/nagios/libexec/check_hpasm-H$HOSTADDRESS$-Csou_shi

}

被监控主机配置内容如下:

##########################hp_monitor##################################

defineservice{

usehp-service

host_name192.168.1.223

service_descriptioncheck_hp_hardware

check_commandcheck_hp_hardware

}

8,最终监控效果图

异常状态图:

参考文献:

http://kyle.xlau.org/posts/nagios-plugin-for-HP.html

http://labs.consol.de/lang/en/nagios/check_hpasm/

https://alteeve.ca/w/HP-Specific_Notes

http://www.it-slav.net/blogs/2010/03/02/monitor-hp-proliant-with-nagios-or-op5-monitor/

http://downloads.linux.hp.com/SDR/getting_started.html

http://2528332.blog.51cto.com/2518332/972291

http://www.linuxde.net/2013/07/14885.html