本文所涉及插件及安装包下载地址:https://github.com/zhangrj/check_hpasm-hpasm-hphealth
一、工作原理概述
通过在惠普服务器安装hpasm/hp-health软件 (HP Advanced Server Management)监控服务器硬件状态,包括 硬盘、CPU、电源、风扇、温度和内存模块,nagios插件通过snmp协议获取这些信息。
二、安装nagios插件check_hpasm
直接拷贝文件check_hpasm至/usr/local/nagios/libexec/或者/usr/lib/nagios/plugins/。
三、安装hpasm/hp-health
hpasm在较新版本中被拆分为hp-health+hp-snmp-agents,可以认为hpasm=hp-health + hp-snmp-agents。
1、在suse9中,可安装hpasm,过程如下:
szmrc1:~ # rpm -ivh hpasm-7.2.0-198.sles9.i586.rpm
Preparing... ########################################### [100%]
1:hpasm ########################################### [100%]
Please read the Licence Agreement for this software at
/opt/compaq/hpasm/hpasm.license
By not removing this package, you are accepting the terms
of the "License for HP Value Added Software".
==============================================================================
NOTE: In order to activate the software contained in this package, you must
type 'hpasm activate' as 'root' user.
You may subsequently reset your agent configuration by typing
'/etc/init.d/hpasm configure' or '/etc/init.d/hpasm reconfigure'.
==============================================================================
The hpasm RPM has installed successfully.
根据提示输入hpasm activate激活软件,然后输入/etc/init.d/hpasm configure完成相关配置。
2、在suse11中,可安装hp-health+hp-snmp-agents,过程如下:
SZMRC8:~ # rpm -ivh hp-health-10.30-1752.14.sles11.x86_64.rpm hp-snmp-agents-10.00-2654.35.sles11.x86_64.rpm net-snmp-5.4.2.1-8.12.6.1.x86_64.rpm perl-SNMP-5.4.2.1-8.12.6.1.x86_64.rpm
warning: hp-health-10.30-1752.14.sles11.x86_64.rpm: Header V3 RSA/SHA1 signature: NOKEY, key ID b1275ea3
warning: hp-snmp-agents-10.00-2654.35.sles11.x86_64.rpm: Header V3 RSA/SHA1 signature: NOKEY, key ID 5ce2d476
Preparing... ########################################### [100%]
1:hp-health ########################################### [ 25%]
Please read the Licence Agreement for this software at
/opt/hp/hp-health/hp-health.license
By not removing this package, you are accepting the terms
of the "HP Proliant Essentials Software End User License Agreement".
Using Proliant High Performance
IPMI based System Health Monitor
Using standard Linux IPMI device driver
Starting ipmi drivers: done
Starting Proliant High Performance
IPMI based System Health Monitor (hpasmxld):
done
Starting HP Advanced Server Recovery Daemon done
The hp-health RPM has installed successfully.
2:net-snmp ########################################### [ 50%]
Updating etc/sysconfig/net-snmp...
3:hp-snmp-agents ########################################### [ 75%]
Please read the Licence Agreement for this software at
/opt/hp/hp-snmp-agents/hp-snmp-agents.license
By not removing this package, you are accepting the terms
of the "HP Proliant Essentials Software End User License Agreement".
==============================================================================
NOTE: In order to activate the software contained in this package, you must
type '/sbin/hpsnmpconfig' as 'root' user.
Once configuration is completed start the agents by typing
/etc/init.d/hp-snmp-agents start
==============================================================================
4:perl-SNMP ########################################### [100%]
根据提示键入/sbin/hpsnmpconfig配置hp-snmp客户端,然后键入/etc/init.d/hp-snmp-agents启动客户端,不在赘述。
四、测试插件
在采集机上,测试check_hpasm能否正确获取监控数据,过程如下:
[root@centreon libexec]# ./check_hpasm --help
查看用法
[root@centreon libexec]# ./check_hpasm -H *.*.*.* -C snmp_community
OK - System: 'proliant bl460c g6', S/N: 'CNG001S3QZ', ROM: 'I24 10/01/2009', hardware working fine, da: 1 logical drives, 2 physical drives
如果不能取得数据,在排除网络不通的情况下,最可能的原因是161端口已被占用,导致snmpd使用了端口1611。在测试插件时指定端口为1611,观看能否取得监控数据。
正常情况下端口使用情况:
szmrc4:~ # netstat -ntplu|grep snmp
tcp 0 0 0.0.0.0:199 0.0.0.0:* LISTEN 12323/snmpd
udp 0 0 127.0.0.1:25375 0.0.0.0:* 12323/snmpd
udp 0 0 0.0.0.0:161 0.0.0.0:* 12323/snmpd
udp 0 0 0.0.0.0:162 0.0.0.0:* 12942/snmpagent
udp 0 0 0.0.0.0:163 0.0.0.0:* 12942/snmpagent
默认161端口无法获取数据时的端口使用情况:
szmrc5:/etc # netstat -nutpl|grep snmp
tcp 0 0 0.0.0.0:199 0.0.0.0:* LISTEN 9822/snmpd
udp 0 0 127.0.0.1:25375 0.0.0.0:* 9822/snmpd
udp 0 0 0.0.0.0:161 0.0.0.0:* 14790/snmpagent
udp 0 0 0.0.0.0:162 0.0.0.0:* 14790/snmpagent
udp 0 0 0.0.0.0:1611 0.0.0.0:* 9822/snmpd
测试插件时指定端口为1611:
[root@centreon libexec]# ./check_hpasm -H *.*.*.* -C snmp_community --port 1611
OK - System: 'proliant bl460c g6', S/N: 'CNG001S3QZ', ROM: 'I24 10/01/2009', hardware working fine, da: 1 logical drives, 2 physical drives
五、Centreon中新建command
comand类型为check,Command Line为:
$USER4$/check_hpasm -H $HOSTADDRESS$ -C $ARG1$ --port $ARG2$ --perfdata=long
Argument Descriptions 描述如下:
ARG1 : snmp_community_string
其中$USER4$表示check_hpasm插件所在路径。如果snmp使用的端口为1611或其他,则Command Line改为:
$USER4$/check_hpasm -H $HOSTADDRESS$ -C $ARG1$ --port $ARG2$ --perfdata=long
Argument Descriptions 描述如下:
ARG1 : snmp_community_string
ARG2 : 1611
六、添加service
为被监控host添加service,check command选择第五步中新建的command,填入相关信息。
之后照例重启监控引擎,configuration-monitoring engines,选择poller,
Restart Monitoring Engine 的method选择restart,勾选前四项,点击Export即可。