首页 > 代码库 > nagios(icinga)借助check_hp插件监控惠普服务器硬件信息
nagios(icinga)借助check_hp插件监控惠普服务器硬件信息
nagios(icinga)借助check_hp插件监控惠普服务器硬件信息
http://cpan.metacpan.org/authors/id/D/DT/DTOWN/Net-SNMP-v6.0.1.tar.gz
http://exchange.nagios.org/directory/Plugins/Hardware/Server-Hardware/HP-(Compaq)/check_hp/details
被监控端:
$ sudo apt-get install snmpd
$ sudo vi /etc/snmp/snmpd.conf (在Access Control下写,它上面部分全删除,除下面内容外Access Control其余部分也删除)
按a或i进入编辑模式
com2sec readuser default public (注意此处community为public,可改)
group readgroup v1 readuser
group readgroup v2c readuser
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1
view all included .1
access readgroup "" any noauth exact all none none
按ESC退出编辑模式
:wq (保存并退出)
$ sudo servcie snmpd restart
$ sudo vi /etc/apt/source.list
按a或i进入编辑模式
deb http://downloads.linux.hp.com/downloads/ManagementComponentPack/ubuntu precise current/non-free
按ESC退出编辑模式
:wq (保存并退出)
$ sudo apt-get update
$ sudo apt-get install hp-health hp-snmp-agents hpacucli
$ sudo vi /etc/snmp/snmpd.conf (在最前面添加,ming是随意写的)
按a或i进入编辑模式
dlmod cmaX /usr/lib/libcmaX64.so
rwcommunity ming 127.0.0.1
rocommunity ming 127.0.0.1
trapcommunity ming
trapsink ming
按ESC退出编辑模式
:wq (保存并退出)
$ sudo service snmpd restart
$ sudo hp-snmp-agents restart
需要只保留一个网口,其余不用网口需要禁掉(sudo ifconfig eth1 down)
监控端:
$ tar zxfv Net-SNMP-v6.0.1.tar.gz
$ cd Net-SNMP-v6.0.1
$ perl Makefile.PL
$ sudo make
$ sudo make install
$ cd
$ tar zxfv check_hp-2.9.tar.gz
$ cd check_hp-2.9
$ sudo cp check_hp /usr/local/nagios/libexec/
验证下是否可用:
$ /usr/local/nagios/libexec/check_hp -H 被监控端ip(如:10.0.1.3,计算机名也可) -C public(和被监控端snmpd.conf文件中community处一致) (加-d会显示详细信息)
正常显示如下:
Compaq/HP Agent Check:overall system state OK
$ sudo vi /usr/local/nagios/etc/objects/commands.cfg
# command ‘check_hp‘
define command{
command_name check_hp
command_line $USER1$/check_hp -H $HOSTADDRESS$ -C $ARG1$
}
:wq
$ sudo vi /usr/local/nagios/etc/objects/ming.cfg
define service {
use generic-service
host_name ming,ming2
service_description check_hp
check_command check_hp!public
}
:wq
本文出自 “linux” 博客,谢绝转载!