How to properly monitor your Dell RAID and physical disks using VMWare ESXi 5.5

Steps are required.

 

1. download VMWare CLI https://my.vmware.com/group/vmware/details?downloadGroup=VCLI550&productId=352

2.

Download check_megaraid_sas @ http://www.techno-obscura.com/~delgado/code/check_megaraid_sas
a change has to be made in the script to make it report correctly:

on line 144, change

if ( m/Size\s*:\s*((\d+\.?\d*)\s*(MB|GB|TB))/ ) {

to

if ( m/^Size\s*:\s*((\d+\.?\d*)\s*(MB|GB|TB))/ ) {

Copy both MegaCli and check_megaraid_sas to your vmware host
copy MegaCli /usr/bin/
chmod +x check_megaraid_sas
copy check_megaraid_sas /usr/share/snmp/

3. test that it’s working

Now check your megaraid controller from the command line-
/usr/share/snmp/check_megaraid_sas -s (num of spares)

from a good system, you should get:
/usr/share/snmp/check_megaraid_sas -s 3
OK: 0:0:RAID-5:3 drives:271.899GB:Optimal 0:1:RAID-1:2 drives:135.899GB:Optimal 0:2:RAID-1:2 drives:135.899GB:Optimal 0:3:RAID-5:3 drives:271.899GB:Optimal 0:4:RAID-5:3 drives:271.898GB:Optimal 0:5:RAID-5:8 drives:951.794GB:Optimal Drives:24 Hotspare(s):3

a system starting to have trouble:
/usr/share/snmp/check_megaraid_sas -s 3
WARNING: 0:0:RAID-5:3 drives:271.945GB:Optimal 0:1:RAID-1:2 drives:135.972GB:Optimal 0:2:RAID-1:2 drives:135.972GB:Optimal 0:3:RAID-5:3 drives:271.945GB:Optimal 0:4:RAID-5:3 drives:271.945GB:Optimal 0:5:RAID-5:8 drives:951.808GB:Optimal Drives:23 Hotspare(s):2 (of 3)

(yes I know, raid5 bad bad bad, tell that to the customer who insists on it…)

4.

now to edit /etc/snmp/snmpd.conf
In the section called : Access Control
scroll down until you find “Third, create a view for use to let the group have rights to:

you’ll need to add
view systemview included .1.3.6.1.4.1.6876.99999

now scroll down until you find: Executable/scripts
Add in
exec .1.3.6.1.4.1.6876.99999.2 check_megaraid_sas /usr/share/snmp/check_megaraid_sas -s 3

note, the -s shows how many active spares you have assigned! if any are missing, that’s usually a sign of a problem…

now, save and restart snmpd

service snmpd restart

now, from nagios machine:

snmpwalk -v 1 -c public <HOSTNAME or IP> .1.3.6.1.4.1.6876.99999

this will walk through (and hopefully) display the output of your script. if it works, you should wind up with:

SNMPv2-SMI::enterprises.6876.99999.2.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.6876.99999.2.2.1 = STRING: “check_megaraid_sas”
SNMPv2-SMI::enterprises.6876.99999.2.3.1 = STRING: “/usr/share/snmp/check_megaraid_sas -s 3”
SNMPv2-SMI::enterprises.6876.99999.2.100.1 = INTEGER: 0
SNMPv2-SMI::enterprises.6876.99999.2.101.1 = STRING: “OK: 0:0:RAID-5:3 drives:271.899GB:Optimal 0:1:RAID-1:2 drives:135.899GB:Optimal 0:2:RAID-1:2 drives:135.899GB:Optimal 0:3:RAID-5:3 drives:271.899GB:Optimal 0:4:RAID-5:3 drives:271.898GB:Optimal 0:5:RAID-5:8 drives:951.794GB:Optimal Drives:24 Hotspare(s):3”
SNMPv2-SMI::enterprises.6876.99999.2.102.1 = INTEGER: 0
SNMPv2-SMI::enterprises.6876.99999.2.103.1 = “”

5.

First part done! *whew*

Now to pull this into nagios!

you’ll notice from this part of the reply, that the only thing we really care about is

SNMPv2-SMI::enterprises.6876.99999.2.101.1 = STRING: “OK: 0:0:RAID-5:3 drives:271.899GB:Optimal 0:1:RAID-1:2 drives:135.899GB:Optimal 0:2:RAID-1:2 drives:135.899GB:Optimal 0:3:RAID-5:3 drives:271.899GB:Optimal 0:4:RAID-5:3 drives:271.898GB:Optimal 0:5:RAID-5:8 drives:951.794GB:Optimal Drives:24 Hotspare(s):3”

This is the output of your script. you’ll need to have something else to pull that in!

First thing is to create the command for nagios to use:
I store mine in a file under /etc/nagios-plugins/config/check_megaraid_snmp.cfg
cat check_megaraid_snmp.cfg

# ‘check_megaraid_snmp’ command definition
define command{
command_name check_megaraid_snmp
command_line /usr/lib/nagios/plugins/check_megaraid_snmp $HOSTADDRESS
}

save and close it.

check the script for correctness by running

/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg

If you get an answer of: Things look okay – blah blah blah, then go onto the next step

5

Configuring Nagios, part 2 (or the wall of TL;DR)

The script! you’ll notice we named it check_megaraid_snmp above, so let’s create the file now
vi /usr/lib/nagios/plugins/check_megaraid_snmp (or whatever flavor of editor you prefer)
—–
#!/bin/sh

if [ $# -lt 1 ]; then
echo “Usage: $0 <host>”
exit -1
fi

HOST=$1

TMPFILE=`mktemp /tmp/check_megaraid_snmp.XXXXXX`

FOUND=`snmpget $HOST -c public -v 1 .1.3.6.1.4.1.6876.99999.2.101.1 | cut -d”\”” -f 2 > $TMPFILE 2>&1`
RES=$?

if [ $RES != 0 ]; then
cat $TMPFILE
/bin/rm -f $TMPFILE
exit 2
fi

STATUS=`cat $TMPFILE | cut -d”:” -f 1`
echo $STATUS
CHRS=`echo $STATUS | grep OK`
TESTVAL=$?
if [ $TESTVAL -eq 0 ]; then
#echo “OK!”
RETVAL=0
else
CHRS=`echo $STATUS | grep WARNING`
TESTVAL=$?
if [ $TESTVAL -eq 0 ]; then
#echo “Warning, something’s wrong”
RETVAL=1
else
CHRS=`echo $STATUS | grep CRITICAL`
TESTVAL=$?
if [ $TESTVAL -ne 0 ]; then
#echo “you’re screwed”
RETVAL=3
else
RETVAL=2
fi
fi
fi

#echo ‘end’
cat $TMPFILE
/bin/rm -f $TMPFILE
echo $RETSTR
#echo $RETVAL
exit $RETVAL

—-

*whew* that’s a mouthful. save it and close. recheck nagios, then restart it

6

Configuring Nagios, part 3 (The end… supposedly)

Now for the final part! let’s add the command to your host check!

Inside the host file for your vm host, add this definition:

define service{
use generic-service ; Name of service template to use
host_name acpevmsqlhost01
service_description MegaRaid status
check_command check_megaraid_snmp
}

save, close, recheck nagios, restart

Now check your nagios site for status:

7

Good output in Nagios

If this helped you, please refer people for our services! and LIKE us on facebook https://facebook.com/cdnhost

 

https://cdnhost.net