nagios监控dell服务器
Server:
check_openmanage 是一个 Nagios 的插件,它基于 OMSA 获取相关的报道信息,用来检测安装有 OpenManage Server Administrator (OMSA) 的戴尔服务器的运行状态,包括存储系统、电源、温度等信息。
官网:http://folk.uio.no/trondham/software/check_openmanage.html
最新版本下载链接:http://folk.uio.no/trondham/software/files/check_openmanage-3.7.12.tar.gz
nagios提供了两种方式进行监控信息的获取。
1、nagios 服务器端 check_nrpe 调用被监控端的 check_openmanage 来实现,这种方式要在被监控端安装 OMSA 和 check_openmanage,check_nrpe会消耗服务器性能,不建议使用
2、nagios 服务器端直接通过 check_openmanage 来远程监控。这种方式要在 nagios 服务器端安装 perl-Net-SNMP,在被监控端安装SNMP和OMSA。这种方式也适合使用zabbix的运维监控环境。
1、安装 perl-Net-SNMP
[root@localhost src]# yum install -y perl-Net-SNMP
2、check_openmanage安装
[root@localhost src]# tar zxvf check_openmanage-3.7.12.tar.gz [root@localhost src]# cd check_openmanage-3.7.12[root@localhost check_openmanage-3.7.12]# cp check_openmanage /usr/local/nagios/libexec[root@localhost check_openmanage-3.7.12]# cd /usr/local/nagios/libexec[root@localhost libexec]# chown nagios:nagios check_openmanagenew [root@localhost libexec]# ./check_openmanage --help 【通用选项】-f,--config # 指定配置文件-p,--perfdata # 输出性能数据,常和--only连用,不要和-d连用-t,--timeout 时间值 # 设定check_openmanage的执行超时时间-c,--critical # 自定义温度的critical阈值-w,--warning # 自定义温度的warning阈值-F,--fahrenheit # 使用华氏温度作为温度单位-d,--debug # 显示所有检查项目-h,--help # 获取check_openmanage帮助信息-V,--version # 获取check_openmanage的版本信息【SNMP选项】-H,--hostname # 使用snmp协议,获取指定主机名或ip的服务器硬件信息-C,--community # 自定义snmp的团体名,默认为public-P,--protocol # 自定义snmp的协议版本,默认为2c--port # 自定义snmp的端口号,默认为161-6,--ipv6 # 使用ipv6替代ipv4,默认为no--tcp # 使用TCP协议替代UDP协议,默认为no【输出选项】-i,--info # 输出的警告信息加上服务器的SN号作为前缀-e,--extinfo # 输出系统信息-s,--state # 输出的信息之前自带警告级别,如warning或critical-S,--short-state # 输出的信息之前自带警告级别缩写,如W或C-o,--okinfo # 输出信息为一行(默认)-B,--show-blacklist # 输出黑名单列表信息,如果加入黑名单的信息多了,可以通过-B查看黑名单的列表信息-I,--htmlinfo # 输出带可点击链接的html格式信息【检查控制和黑名单】-a,--all # 获取日志统计和详细日志输出-b,--blacklist component=ID号 # 黑名单,指定某个组件的指定ID信息不显示。ID信息通过./check_openmanage -d可以看到。./check_openmanage -H 10.15.98.177 -d--only # 仅输入某项监控数据--check component=[0|1],esmlog=[0|1] # 检查单个项目或组合项目,0为不检查,1为检查,单独使用--no-storage # 不检查存储信息--vdisk-critical # 将虚拟磁盘的任何警告都提升为崩溃级别critical 【自定义输出信息】--postmsg '自定义信息' # 在输出的结尾输出该自定义信息在自定义信息中,我们可以使用如下变量 %m # 系统型号 %s # 系统SN号 %b # BIOS版本 %d # BIOS发型时间 %o # 操作系统名称 %r # 操作系统内核版本 %p # 物理磁盘数量 %l # 逻辑磁盘数量 %n # 表示换行符 %% # 表示%百分号 [root@localhost libexec]# ./check_openmanage 如果提示"Storage Error",则需要加上--no-storage参数,不带任何参数默认输出服务器的warning和critical的报警信息 [root@localhost libexec]# ./check_openmanage -s 输出带有状态提示的信息 [root@localhost libexec]# ./check_openmanage -s -b ctrl_fw=0 不检查Firmware固件版本更新提示 [root@localhost libexec]# ./check_openmanage -s -b pdisk_cert=all 不检查磁盘未认证的提示 [root@localhost libexec]# ./check_openmanage -b ctrl_fw=0\/pdisk=0:0:1:0 不检查ID为0的Firmware固件版本更新提示和ID为0:0:1:0的物理磁盘的未认证提示 [root@localhost libexec]# ./check_openmanage -b ctrl_fw=0\/pdisk=ALL 不检查ID为0的Firmware固件版本更新提示和未认证的物理磁盘提示[root@localhost libexec]# ./check_openmanage -d 输出所有检查项目[root@localhost libexec]# ./check_openmanage -i 将服务器的SN号作为警告信息的输出前缀[root@localhost libexec]# ./check_openmanage --no-storage 不检查存储[root@localhost libexec]# ./check_openmanage -e -b ctrl_fw=0\/pdisk=ALL 不显示Firmware固件版本更新和未认证磁盘提示信息,并输出系统信息[root@localhost libexec]# ./check_openmanage -H 10.15.98.177 -C public -e -b bat=0:0 -b ctrl_fw=0\/pdisk=ALL --postmsg %oController 1 [PERC H800 Adapter]: Firmware '12.10.4-0001' is out of date[root@localhost libexec]# ./check_openmanage -H 10.15.98.177 -d|grep -C3 "is out of date" STATE | ID | MESSAGE TEXT ---------+----------+-------------------------------------------------------- OK | 0 | Controller 0 [PERC H310 Adapter] is ReadyCRITICAL | 1 | Controller 1 [PERC H800 Adapter]: Firmware '12.10.4-0001' is out of date #id为1 OK | 1 | Controller 1 [PERC H800 Adapter] is Degraded OK | 0:0:1:0 | Physical Disk 0:1:0 [SAS-HDD 300GB] on ctrl 0 is Online OK | 1:0:0:2 | Physical Disk 0:0:2 [SAS-HDD 2.0TB] on ctrl 1 is Online[root@localhost libexec]# ./check_openmanage -H 10.15.98.177 -C public -e -b ctrl_fw=1 -b bat=0:0 -b ctrl_fw=0\/pdisk=ALL --postmsg %oOK - System: 'PowerEdge R620', SN: '马赛克', 16 GB ram (4 dimms), 2 logical drives, 7 physical drives[root@localhost libexec]# ./check_openmanage -H 10.17.205.164 -C public -e -b bat=0:0 -b ctrl_fw=0 -b ctrl_fw=0\/pdisk=ALL --postmsg %oController 0 [PERC H700 Integrated]: Driver '4.05.01.64' is out of date[root@localhost libexec]# ./check_openmanage -H 10.17.205.164 -d|grep -i "is out of date"CRITICAL | 0 | Controller 0 [PERC H700 Integrated]: Firmware '12.10.1-0001' is out of date #-b ctrl_fw=0 忽略此项CRITICAL | 0 | Controller 0 [PERC H700 Integrated]: Driver '4.05.01.64' is out of date #-b ctrl_driver=0 忽略此项[root@localhost libexec]# ./check_openmanage -H 10.17.205.164 -C public -e -b bat=0:0 -b ctrl_fw=0 -b ctrl_driver=0 -b ctrl_fw=12.10.4-0001\/pdisk=ALL --postmsg %oOK - System: 'PowerEdge R710 II', SN: '3D4973X', 32 GB ram (8 dimms), 2 logical drives, 5 physical drives[root@localhost libexec]# ./check_openmanage -H 192.168.100.165 -C public -e -b bat=0:0 -b ctrl_driver=ALL\/ctrl_fw=ALL\/pdisk=ALL --postmsg %oBattery probe 0 [System Board CMOS Battery] is Unknown reading------ SYSTEM: PowerEdge R630, SN: 马赛克Microsoft Windows Server 2008 R2, Enterprise x64 Edition[root@localhost libexec]# ./check_openmanage -H 192.168.100.165 -C public -e -b bat=0:0\/bp=ALL\/ctrl_driver=ALL\/ctrl_fw=ALL\/pdisk=ALL --postmsg %oOK - System: 'PowerEdge R630', SN: '马赛克', 128 GB ram (8 dimms), 1 logical drives, 3 physical drives #bp=ALL 忽略电池检测[root@localhost libexec]#
黑名单功能中可以使用的参数表
更多信息查看官方文档
Tips:最近发现一台服务器硬盘坏了,nagios里还是显示warning,所以将check_openmange里的344行的warning改成critical,便于及时发现
[root@localhost libexec]# vim check_openmanage 341 %reverse_exitcode 342 = ( 343 $E_OK => 'OK', 344 $E_WARNING => 'CRITICAL', 345 $E_CRITICAL => 'CRITICAL', 346 $E_UNKNOWN => 'UNKNOWN', 347 );
3、配置command
[root@localhost libexec]# vim /usr/local/nagios/etc/objects/commands.cfg#检查存储设备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是黑名单,由于我们的服务器固件版本低,为不影响其他监控项在此我们将其加入黑名单将其剔除。
4、配置监控服务
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 }
报错1:
ERROR: You need perl module Net::SNMP to run check_openmanage in SNMP mode
原因:
SNMP监控模式下,check_openmanage 需要 perl-Net-SNMP 支持
解决方案:
安装perl-Net-SNMP包
# yum install -y perl-Net-SNMP
报错2:
ERROR: (SNMP) OpenManage is not installed or is not working correctly
SNMP TABLE ERROR : Requested table is empty or does not exist
原因:
snmp未配置导致。如果先安装snmp,在安装omsa的时候会自动帮你配置好snmp
解决方案:
1、先安装net-snmp,再安装omsa(即srvadmin-all)
or
2、手动配置信息如下:
vim /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 一般安装srvadmin的时候会自动加上的
报错3:
SNMP CRITICAL: No response from remote host 'X.X.X.X'
原因:
被监控端没有安装snmp服务
解决方案:
安装snmp服务
# yum install -y net-snmpd
Client:
对Dell服务器的硬件监控需要安装DELL的OMSA,DELL OMSA的全称为Dell Openmanage Server Administrator,它是戴尔公司基于自主研发力量开发的IT系统管理解决方案,
nagios监控Dell linux系统
1、安装snmp服务
[root@BETA6 yum.repos.d]# yum -y install net-snmp net-snmp-devel net-snmp-utils
2、安装dell的yum源
wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
或者
wget -q -O - http://linux.dell.com/repo/hardware/OMSA_7.2/bootstrap.cgi | bash
注意:只适用rhel系统,CentOS系统无法安装
[root@BETA6 src]# wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bashCleaning up EverythingDone![root@BETA6 src]#
3、安装dell osma
yum -y install OpenIPMI srvadmin-all
或者
yum install -y srvadmin-base srvadmin-storageservices 推荐,安装必要的软件,速度快
[root@BETA6 yum.repos.d]# yum -y install OpenIPMI srvadmin-all[root@BETA6 yum.repos.d]# /opt/dell/srvadmin/sbin/srvadmin-services.sh start[root@BETA6 yum.repos.d]# /etc/init.d/dataeng stop[root@BETA6 yum.repos.d]# /etc/init.d/dataeng start[root@BETA6 yum.repos.d]# chkconfig dataeng on或者[root@BETA6 yum.repos.d]# /opt/dell/srvadmin/sbin/srvadmin-services.sh enable 推荐instsvcdrv 0:off 1:off 2:on 3:on 4:on 5:on 6:offdataeng 0:off 1:off 2:on 3:on 4:on 5:on 6:offdsm_om_shrsvc 0:off 1:off 2:on 3:on 4:on 5:on 6:offipmi 0:off 1:off 2:on 3:on 4:on 5:on 6:off[root@BETA6 yum.repos.d]# /opt/dell/srvadmin/sbin/srvadmin-services.sh statusdell_rbu(module) is runningipmidriver is runningdsm_sa_datamgrd(pid 1331 1197) is runningdsm_sa_eventmgrd(pid 1381) is runningdsm_sa_snmpd(pid 1440) is runningdsm_om_shrsvcd(pid 1508) is running...dsm_om_connsvcd(pid 1562) is running...[root@BETA6 yum.repos.d]# netstat -antlp|grep :1311
如果有此端口则说明我们的srvadmin安装成功,如果没有可能是安装出现问题了;dsm_om_connsvc服务监听了TCP协议的1311端口,并且提供了http访问的功能。另外我们安装完后首次启动用/opt/dell/srvadmin/sbin/srvadmin-services.sh start,否则用service dataeng start启动可能会有问题,导致omsa没有完全启动。dsm_om_connsvc服务监听了TCP协议的1311端口,并且提供了http访问的功能。
注意:
(1)一定要先安装snmp服务再安装omsa,这样omsa会自动将你的snmp服务进行配置,如果顺序颠倒则可能会导致报一下错误:
ERROR: (SNMP) OpenManage is not installed or is not working correctly
这是因为我们的/etc/snmp/snmpd.conf配置文件有漏改的地方,主要是以下几处:(改正以后如下)
view all included .1
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
access notConfigGroup ""any noauth exact all all none
(2)如果报一下错误“SNMP CRITICAL: No response from remote host 'X.X.X.X'”,则说明被监控端没有安装snmp服务
4、查看本机的硬件状态
1)查看系统主要组件的温度
[root@BETA6 yum.repos.d]# /opt/dell/srvadmin/bin/omreport chassis tempsTemperature Probes Information------------------------------------Main System Chassis Temperatures: Ok------------------------------------Index : 0Status : OkProbe Name : System Board Inlet TempReading : 27.0 CMinimum Warning Threshold : 3.0 CMaximum Warning Threshold : 42.0 CMinimum Failure Threshold : -7.0 CMaximum Failure Threshold : 47.0 C......
2)查看虚拟硬盘的状态
[root@BETA6 yum.repos.d]# /opt/dell/srvadmin/bin/omreport storage vdisk controller=0Virtual Disk 0 on Controller PERC H710 Mini (Embedded)Controller PERC H710 Mini (Embedded)ID : 0Status : OkName : Virtual Disk 0State : ReadyHot Spare Policy violated : Not AssignedEncrypted : NoLayout : RAID-5Size : 1,675.50 GB (1799054426112 bytes)Device Name : /dev/sda......
3)查看控制器(即RAID卡)的属性
[root@BETA6 yum.repos.d]# /opt/dell/srvadmin/bin/omreport storage controller Controller PERC H710 Mini (Embedded)ControllersID : 0Status : OkName : PERC H710 MiniSlot ID : EmbeddedState : ReadyFirmware Version : 21.2.0-0007Latest Available Firmware Version : Not ApplicableDriver Version : 00.00.06.15-rhMinimum Required Driver Version : Not ApplicableStorport Driver Version : Not ApplicableMinimum Required Storport Driver Version : Not ApplicableNumber of Connectors : 2Rebuild Rate : 30%......
5、防火墙配置
由于我们使用的是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
OMSA在Windows服务器上安装部署
访问戴尔技术支持的官方网站:,根据sn号查找驱动程序选项栏里统管理标签下下载对应的版本
具体安装过程参照此贴:http://zh.community.dell.com/techcenter/systems-management/w/wiki/559.omsawindows