天天看點

icinga2通過check_hpasm監控HP伺服器硬體報警

icinga2通過check_hpasm監控HP伺服器硬體報警:

https://labs.consol.de/nagios/check_hpasm/#download

注:該工具也可用來直接監控Windows系統,Windows伺服器在安裝系統時預設會安裝hp-snmp-agents元件

被監控伺服器需安裝hp-snmp-agents(及snmp)

# dpkg -i hp-snmp-agents_10.40-2909.34_amd64.deb

# /sbin/hpsnmpconfig

輸入y (即使用已有/etc/snmp/snmpd.conf配置)

如果報下面錯誤,解決辦法也簡單(不一定通用,我遇到的是這麼好的),執行/sbin/hpsnmpconfig,然後選擇n,第1項随便輸入2次一樣的密碼(commutiy那個),後面全預設回車,就好了

CRITICAL - snmpwalk returns no product name (cpqsinfo-mib), wrong device

redhat上可通過下面指令排錯:

# snmpwalk -v 2c -c public 127.0.0.1  1.3.6.1.4.1.232

# /etc/init.d/hp-snmp-agents status  (確定是start狀态)

# 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="SPD.ubuntusrv#989"

  vars.perf="--perfdata=short"

  assign where host.address == "10.29.1.52" || host.address == "10.29.1.53"

# service icinga2 restart

也可借助被監控端的nrpe(不易受網絡影響)

Ubuntu:

# vi /etc/nagios/nrpe.cfg

command[check_hpubt]=/usr/lib/nagios/plugins/check_hpasm -H 127.0.0.1 -C public

# service nagios-nrpe-server restart

Redhat:

command[check_hpubt]=sudo /usr/lib64/nagios/plugins/check_hpasm -H 127.0.0.1 -C public

# service nrpe restart

# vi /etc/sudoers

nagios  ALL=(ALL)       NOPASSWD:/usr/lib64/nagios/plugins/*

#Defaults    requiretty (預設未注釋)

監控端icinga2配置略

附:

-v:顯示伺服器硬體詳細資訊

--hpasmcli /sbin/hpasmcli  顯示硬碟健康情況

--snmpwalk /usr/bin/snmpwalk 結果同--hpasmcli

--blacklist daac  排除控制器加速器健康情況

https://labs.consol.de/nagios/check_hpasm/

本文轉自linux部落格51CTO部落格,原文連結http://blog.51cto.com/yangzhiming/1943582如需轉載請自行聯系原作者

yangzhimingg

繼續閱讀