您的位置:首页 > 移动开发 > IOS开发

nagios监控dell服务器硬件

2015-05-04 18:18 375 查看
之前讲过利用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

另由于linu版本的问题,若最新的安装源报错,如“downloading XXXX rpm“,我们还是选择另一个版本吧,如下:

wget -q -O - http://linux.dell.com/repo/hardware/DSU_15.01.00/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配置文件有漏改的地方,和安装顺序无关,主要是以下几处:(改正以后如下)

com2sec notConfigUser default public

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服务或配置文件有漏改的地方

5.启动

service snmpd start

chkconfig snmpd on

三,配置监控项

1.配置command

#检查存储设备
define command {
command_name check_storage
command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only storage -p -s -b ctrl_fw=0
}
#检查cpu
define 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服务器硬件监控配完。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: