icinga2通過(guò)check_hpasm監(jiān)控HP服務(wù)器硬件報(bào)警:
專注于為中小企業(yè)提供網(wǎng)站制作、做網(wǎng)站服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)新河免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了近1000家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
https://labs.consol.de/nagios/check_hpasm/#download
注:該工具也可用來(lái)直接監(jiān)控Windows系統(tǒng),Windows服務(wù)器在安裝系統(tǒng)時(shí)默認(rèn)會(huì)安裝hp-snmp-agents組件
被監(jiān)控服務(wù)器需安裝hp-snmp-agents(及snmp)
# dpkg -i hp-snmp-agents_10.40-2909.34_amd64.deb
# /sbin/hpsnmpconfig
輸入y (即使用已有/etc/snmp/snmpd.conf配置)
如果報(bào)下面錯(cuò)誤,解決辦法也簡(jiǎn)單(不一定通用,我遇到的是這么好的),執(zhí)行/sbin/hpsnmpconfig,然后選擇n,第1項(xiàng)隨便輸入2次一樣的密碼(commutiy那個(gè)),后面全默認(rèn)回車,就好了
CRITICAL - snmpwalk returns no product name (cpqsinfo-mib), wrong device
redhat上可通過(guò)下面命令排錯(cuò):
# snmpwalk -v 2c -c public 127.0.0.1 1.3.6.1.4.1.232
# /etc/init.d/hp-snmp-agents status (確保是start狀態(tài))
# tar zxfv check_hpasm-4.7.5.4.tar.gz
# cd check_hpasm-4.7.5.4
# ./configure
# make
# make install
# cp -rv /usr/local/nagios/libexec/check_hpasm /usr/lib64/nagios/plugins/
# /usr/lib64/nagios/plugins/check_hpasm -H 10.0.0.3 -C public --perfdata=short
配置icinga2
# vi /etc/icinga2/conf.d/templates.conf
object CheckCommand "HP" {
import "plugin-check-command"
command = [ PluginDir + "/check_hpasm" ]
arguments = {
"-H" = "$address$"
"-C" = "$snmp$"
"--perfdata" = "$perf$"
}
}
:wq
# vi /etc/icinga2/conf.d/services.conf
apply Service "HP" {
import "generic-service"
check_command = "HP"
vars.snmp="xxxxxxx"
vars.perf="--perfdata=short"
assign where host.address == "10.0.0.2" || host.address == "10.0.0.3"
}
:wq
# service icinga2 restart
也可借助被監(jiān)控端的nrpe(不易受網(wǎng)絡(luò)影響)
Ubuntu:
# vi /etc/nagios/nrpe.cfg
command[check_hpubt]=/usr/lib/nagios/plugins/check_hpasm -H 127.0.0.1 -C public
:wq
# service nagios-nrpe-server restart
Redhat:
# vi /etc/nagios/nrpe.cfg
command[check_hpubt]=sudo /usr/lib64/nagios/plugins/check_hpasm -H 127.0.0.1 -C public
:wq
# service nrpe restart
# vi /etc/sudoers
nagios ALL=(ALL) NOPASSWD:/usr/lib64/nagios/plugins/*
#Defaults requiretty (默認(rèn)未注釋)
:wq
監(jiān)控端icinga2配置略
附:
-v:顯示服務(wù)器硬件詳細(xì)信息
--hpasmcli /sbin/hpasmcli 顯示硬盤健康情況
--snmpwalk /usr/bin/snmpwalk 結(jié)果同--hpasmcli
--blacklist daac 排除控制器加速器健康情況
https://labs.consol.de/nagios/check_hpasm/