標籤:nagios+check_openman check_openmanage omsa nagios+omsa
之前講過利用omsa來監控dell伺服器,但是必須通過web來訪問,這次我們結合nagios+check_openmanage來實現dell伺服器的硬體監控。
首先我們來看下面這張圖:
由看出有兩種方式可以實現監控:
1.nagios伺服器端check_nrpe調用被監控端的check_openmanage來實現,這種方式要在被監控端安裝omsa和check_openmanage
2.nagios伺服器端直接通過check_openmanage來遠程監控,這種方式要在nagios伺服器端安裝perl-Net-SNMP,在被監控端安裝omsa,snmp服務;其中先安裝snmp服務,再安裝omsa,這樣omsa會自動更改snmp的設定檔以實現監控。
個人感覺:使用第二種方式更為方便,只需要安裝即可;而第一種方式還需要再配置nagios用戶端;另外,check_nrpe會消耗伺服器效能;因此以下就是使用snmp來實現的。
一.配置nagios伺服器端
1.在nagios伺服器上安裝check_openmanage
wget http://folk.uio.no/trondham/software/files/check_openmanage-3.7.12.tar.gz tar -xvf check_openmanage-3.7.12.tar.gz cd check_openmanage-3.7.12 cp check_openmanage /usr/local/nagios/libexec chown nagios.nagios /usr/local/nagios/libexec/check_openmanage cp man/check_openmanage.8 /usr/share/man/man8 cp man/check_openmanage.conf.5 /usr/share/man/man5
2.在nagios伺服器上安裝perl-Net-SNMP
Centos5 wget http://mirrors.zju.edu.cn/epel/5/i386/epel-release-5-4.noarch.rpm rpm -ivh epel-release-5-4.noarch.rpm Centos6 wget http://mirrors.zju.edu.cn/epel/6/i386/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm yum install perl-Net-SNMP perl-Config-Tiny
SNMP監控模式下check_openmanage是需要perl-Net-SNMP支援的,否則會出現如下錯誤:
ERROR: You need perl module Net::SNMP to run check_openmanage in SNMP mode
至此我們的nagios伺服器端已經安裝完畢
二.配置被監控端
1.安裝snmp服務
yum -y install net-snmp net-snmp-devel net-snmp-utils
2.安裝omsa
wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
yum install srvadmin-all
3.啟動omsa服務
/opt/dell/srvadmin/sbin/srvadmin-services.sh start
4.查看連接埠
netstat -ntlp |grep :1311
如果有此連接埠則說明我們的srvadmin安裝成功,如果沒有可能是安裝出現問題了;另外我們安裝完後初次開機用/opt/dell/srvadmin/sbin/srvadmin-services.sh start,否則用service dataeng start啟動可能會有問題,導致omsa沒有完全啟動。
注意:
(1)一定要先安裝snmp服務再安裝omsa,這樣omsa會自動將你的snmp服務進行配置,如果順序顛倒則可能會導致報一下錯誤:
ERROR: (SNMP) OpenManage is not installed or is not working correctly
這是因為我們的/etc/snmp/snmpd.conf設定檔有漏改的地方,主要是以下幾處:(改正以後如下)
view all included .1
access notConfigGroup "" any noauth exact all none none
smuxpeer .1.3.6.1.4.1.674.10892.1
(2)如果報一下錯誤“SNMP CRITICAL: No response from remote host ‘X.X.X.X‘”,則說明被監控端沒有安裝snmp服務
三,配置監控項
1.配置command
#檢查存放裝置define command { command_name check_storage command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only storage -p -s -b ctrl_fw=0}#檢查cpudefine command { command_name check_cpu command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only cpu -p -s -b ctrl_fw=0}#檢查記憶體define command { command_name check_memory command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only memory -p -s -b ctrl_fw=0}#檢查電源define command { command_name check_power command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only power -p -s -b ctrl_fw=0}#檢查溫度define command { command_name check_temp command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only temp -p -s -w $ARG1$ -c $ARG2$ -b ctrl_fw=0}
其中--only是指只監控某一項,-p是進行畫圖,-s是狀態原因,-b是黑名單,由於我們的伺服器韌體版本低,為不影響其他監控項在此我們將其加入黑名單將其剔除。
2.配置監控服務組
define servicegroup { servicegroup_name dell-openmanage alias Dell server health status}
3.配置監控服務
define service{ use local-service host_name usvr-131,usvr-119,usvr-70,usvr-71,usvr-72,usvr-73,usvr-82,usvr-83,usvr-84,usvr-85,usvr-86,usvr-87 service_description omsa_storage check_command check_storage service_groups dell-openmanage notifications_enabled 1 } define service{ use local-service host_name usvr-131,usvr-119,usvr-70,usvr-71,usvr-72,usvr-73,usvr-82,usvr-83,usvr-84,usvr-85,usvr-86,usvr-87 service_description omsa_cpu check_command check_cpu service_groups dell-openmanage notifications_enabled 1 } define service{ use local-service host_name usvr-131,usvr-119,usvr-70,usvr-71,usvr-72,usvr-73,usvr-82,usvr-83,usvr-84,usvr-85,usvr-86,usvr-87 service_description omsa_memory check_command check_memory service_groups dell-openmanage notifications_enabled 1 } define service{ use local-service host_name usvr-131,usvr-119,usvr-70,usvr-71,usvr-72,usvr-73,usvr-82,usvr-83,usvr-84,usvr-85,usvr-86,usvr-87 service_description omsa_power check_command check_power service_groups dell-openmanage notifications_enabled 1 } define service{ use local-service host_name usvr-131,usvr-119,usvr-70,usvr-71,usvr-72,usvr-73,usvr-82,usvr-83,usvr-84,usvr-85,usvr-86,usvr-87 service_description omsa_temp check_command check_temp!"0=30/15"!"0=40/10" service_groups dell-openmanage notifications_enabled 1 }
4.檢查設定檔及重新載入設定檔
nagioscheck
service nagios reload
四,防火牆配置
由於我們使用的是SNMP來監控,因此我們需要在被監控端對nagios伺服器開啟snmp連接埠udp 161
/sbin/iptables -A INPUT -i em1 -p udp -s 10.10.5.89 --dport 161 -m comment --comment "nagios snmp" -j ACCEPT
ok,至此dell伺服器硬體監控配完。
nagios監控dell伺服器硬體