服务器型号 HP DL360E g8,已安装HP Array Configuration Utility,现需要通过zabbix监控raid状态,异常
时发出警报.
这里就介绍下通过hpacucli程序结合zabbix实现Raid状态监测.
1.修改windows系统环境变量(计算机->属性->高级系统设置->环境变量->系统变量中修改PATH),将hpacucli的bin路径加入PATH中;(默认:C:\Program Files (x86)\Compaq\Hpacucli\Bin)
2.修改zabbix_agentd.conf文件,利用UserParameter参数自定义agent key:
如:
UserParameter=raid.pdstatus,hpacucli.exe ctrl slot=0 pd all show status| find /C "OK" UserParameter=raid.LDStatus,hpacucli.exe ctrl slot=0 logicaldrive all show status UserParameter=raid.ControllerModel,hpacucli.exe controller all show UserParameter=raid.LDNumber,hpacucli.exe ctrl slot=0 logicaldrive all show status | find "logicaldrive" /C UserParameter=raid.PD1Status,hpacucli.exe ctrl slot=0 physicaldrive 1i:1:1 show status | find /C "OK" UserParameter=raid.PD2Status,hpacucli.exe ctrl slot=0 physicaldrive 1i:1:2 show status | find /C "OK" UserParameter=raid.PD3Status,hpacucli.exe ctrl slot=0 physicaldrive 1i:1:3 show status | find /C "OK"
UserParameter各个含义:
UserParameter=raid.pdstatus,hpacucli.exe ctrl slot=0 pd all show status| find /C "OK" # 用来获取raid中(slot0 代表raid卡所在槽位1) 处于OK正常状态的物理磁盘数量
UserParameter=raid.LDStatus,hpacucli.exe ctrl slot=0logicaldrive all show status
# 用来获取raid中处于OK正常状态的逻辑磁盘数量
UserParameter=raid.ControllerModel,hpacucli.exe controller all show
#用来获取所有raid卡的相关信息
UserParameter=raid.LDNumber,hpacucli.exe ctrl slot=0 logicaldrive all show
#用来获取raid中所有逻辑磁盘的状态信息
UserParameter=raid.LDNumber,hpacucli.exe ctrl slot=0 logicaldrive all show status | find "logicaldrive"/C
#用来获取raid中所有逻辑磁盘的数量
UserParameter=raid.PD1Status,hpacucli.exe ctrl slot=0 physicaldrive 1i:1:1 show status | find /C "OK"
UserParameter=raid.PD2Status,hpacucli.exe ctrl slot=0 physicaldrive 1i:1:2 show status | find /C "OK"
UserParameter=raid.PD3Status,hpacucli.exe ctrl slot=0 physicaldrive 1i:1:3 show status | find /C "OK"
#用来获取raid中1、2、3号盘位硬盘的状态,为了绘图,使用find命令的/C参数进行技术,1
为正常,否则为不正常
3.zabbix web控制台对主机创建item,key指向自己定义的key值即可.
4.agent服务重启(必须).
可以去zabbix web控制台查看监测数据了.
我的监控效果图,如下所示:
各物理磁盘状态图:(1 正常 ; 非1 不正常)
正常状态的物理磁盘的数量图(可以通过这个值配置trigger,来触发警报):
这样,通过创建适当的trigger,就实现了raid状态的实时监控了.