[Xymon] Clariion monitoring

Scott Pfister icepickjazz at gmail.com
Fri Sep 21 17:15:48 CEST 2012


Here's a script we used to monitor clariion.  It requires the navicli
to be installed on the host that runs the monitoring script. In our
case it was the xymon server.  We also found it better to split the
test accross both service processors.  Hence the SPIP and SPIP2
variables.   Ours had no NAS so we didn't montitor anything there.
This was on the old deadcat site and we tweaked it a little.

#!/bin/sh
#set -x
#-------------------------------------------------
# Big Brother - EMC CLARiiON FC-4700 Hardware Agent
#
#	This agent monitor the hardware of an EMC
#	CLARiiON FC-4700 Array using the Navisphere
#	Command Line Interface (NAVICLI)
#
#	Author: Sabey (sabey2000 at hotmail.com)
#
#	Feel free to improve or modify.
#
#==================================================
# History
#--------------------------------------------------
#       Fri Feb 22 11:44:08 MET 2008
#       added global state yellow and Disk status
#
#	Notes:
#		If a disk failed, it was shown yellow in it`s list, but the global
#		status was unchanged. This is fixed now
#		
#		The Disks will show now the status of a binding action in %
#		the same for replacement of a disk
#
#
#	Tue Aug 19 21:34:15 GMT 2003
#	Docs and fixes by N. Rettinghouse (rettinghouse.n0spam at att.net)
#
#	Notes:
#		GNU GAWK is needed. (www.sunfreeware.com for Solaris)
#		Copy clariion.sh into the bb/ext directory.
#		Add the following to your bb/etc/bb-bbexttab:
#			localhost : : clariion.sh
#			A restart of BigBro will be needed after adding bb-bbexttab.
#		Configure the variables shown below.
#		Add the BigBrother user to the /etc/Navisphere/agent.config file to
#			allow running of navicli.
#		Changed "HW" to "hw" to be consistant with other bb services.
#		Fixed conflict with $MACHINE BigBro internal variable.
#		Configure bb-hosts like this:
#			10.10.30.34 SAN-BigusDiskus # testip noping
#		
#---------------------------------------------------
#  Thu Sep  4 11:57:48 EDT 2003
#  Docs and fixes by Sabey (sabey2000 at hotmail.com)
#
#  Notes:
#		Add support to CLARiiON CX600 (maybe all CX series...)
#
#############################################################################
### Set these as needed. ####################################################
#S#SPIP=172.25.2.239							# One of the two SP IP address
#S#EMC_ARRAY="CLARiiON-1"					# The name of your CLARiiON array
SPIP=							# One of the two SP IP address
SPIP2=							# One of the two SP IP address
EMC_ARRAY="emcsan"					# The name of your CLARiiON array
navicli=/opt/Navisphere/bin/navicli	# Where is the NAVICLI cmd
GAWK=/usr/bin/awk				# need GNU AWK
#############################################################################
#############################################################################

TEST="emc"									# The BB test name
MYTMPFILE=CLARIION_STATUS.$$			# Use a buffer tmp file for NAVICLI output
BBPROG=BB_CLARiiON; export BBPROG  	# ???

##---[Check BBHOME is set]--------------------------------
if test "$BBHOME" = ""; then
   echo "BBHOME is not set... exiting"; exit 1
fi
if [ ! -x $GAWK ]; then
	echo "This agent need GNU Awk, check GAWK variable"; exit 1
fi

#---[Load bb global parameter]---------------------------
if test ! "$BBTMP"; then
	. $BBHOME/etc/bbdef.sh
fi

#---[Collect DATA]---------------------------------------
echo "Status of ${EMC_ARRAY} Storage System" > $BBTMP/ITC_CLARiiON.OUT.$$
echo "============================================================================="
>> $BBTMP/ITC_CLARiiON.OUT.$$

#---[1. Get cache
status]---------------------------------------------------------
$navicli -h $SPIP getcache > $BBTMP/$MYTMPFILE
echo "SP Cache" >> $BBTMP/ITC_CLARiiON.OUT.$$
echo "----------------------------" >> $BBTMP/ITC_CLARiiON.OUT.$$
$CAT $BBTMP/$MYTMPFILE | $GAWK '
{
   if ($0 ~ /SP Write|Read Cache State/) {
   sub ("    *"," ")
   if ($0 ~ /State Enabled/) {
   sub (" State Enabled","")
   sub ("^","\\&green ")
   } else {
        sub (" State .*","")
        sub ("^","\\&red ")
   }
   if ($0 !~ /SP Read Cache/) {
   print
   }
   }
}' >> $BBTMP/ITC_CLARiiON.OUT.$$

#---[2. Port status]--------------------------------------------------------------
$navicli -h $SPIP2 port -list > $BBTMP/$MYTMPFILE
echo -e "\nSP Link Status" >> $BBTMP/ITC_CLARiiON.OUT.$$
echo "----------------------------" >> $BBTMP/ITC_CLARiiON.OUT.$$
$CAT $BBTMP/$MYTMPFILE | $GAWK '
{
   if ($0 ~ /Information about each SPPORT:/) {
      FLAG=1
   }
   if (FLAG == 1) {
      if (($0 ~ /SP Name/) || ($0 ~ /SP Port ID/) || ($0 ~ /Link
Status/) || ($0 ~ /Port Status/)) {
         sub ("   *","")
         if ($0 ~ /SP Name/) {
            sub ("SP Name:","")
            SP=$0
         }
         if ($0 ~ /SP Port ID/) {
            sub ("SP Port ID:","Port ")
            Port=$0
         }
         if ($0 ~ /Link Status/) {
            if ($0 ~ /Status:Up/) {
               sub ("Status:Up","\\&green")
            } else {
	       if ((Port == "Port 3") || (Port == "Port 2" )) {
                  sub ("Status:.*","\\&clear")
	       } else {
                       sub ("Status:.*","\\&red")
               }
	    }
            LinkS=$0
         }
         if ($0 ~ /Port Status/) {
            if ($0 ~ /Status:Online/) {
               sub ("Status:Online","\\&green")
            } else {
               if ((Port == "Port 3") || (Port == "Port 2" )) {
                  sub ("Status:.*","\\&clear")
               } else {
               sub ("Status:.*","\\&red")
               }
            }
            sub ("Port","Status")
            PortS=$0
            sub ("Status:","",PortS)
            sub ("Status:","",LinkS)
            print SP,Port,PortS,LinkS
         }
      }
   }
}' >> $BBTMP/ITC_CLARiiON.OUT.$$

#---[3. DPE/DAE
Status]-----------------------------------------------------------
$navicli -h $SPIP getcrus > $BBTMP/$MYTMPFILE
echo -e "\nDPE/DAE Status" >> $BBTMP/ITC_CLARiiON.OUT.$$
echo "----------------------------" >> $BBTMP/ITC_CLARiiON.OUT.$$

$CAT $BBTMP/$MYTMPFILE | $GAWK '
{
   if (($0 ~ /[DPE|DAE] Bus . Enclosure ./) || ($0 ~ /State/)) {
      if ($0 ~ /State/) {
         sub ("Bus . Enclosure . ","")
         sub ("   *"," ")
         sub ("Power","Power Supply")
         if (($0 ~ /State: Present/) || ($0 ~ /State: Valid/)) {
            sub (" State:*","")
            sub ("^","\\&green ")
         }
         else {
            sub (" State:.*","")
            sub ("^","\\&red ")
         }
      }
      if ($0 ~ /[DPE|DAE] Bus . Enclosure ./) {
         print ""
      }
      print
      if ($0 ~ /[DPE|DAE] Bus . Enclosure ./) {
        print "----------------------------"
      }
   }
}' >> $BBTMP/ITC_CLARiiON.OUT.$$

#---[4. Disks status]-------------------------------------------------------------
$navicli -h $SPIP2 getdisk -state -rb -bind > $BBTMP/$MYTMPFILE
echo -e "\nDisks Status" >> $BBTMP/ITC_CLARiiON.OUT.$$
echo "----------------------------" >> $BBTMP/ITC_CLARiiON.OUT.$$
$CAT $BBTMP/$MYTMPFILE | $GAWK ' BEGIN { FLAG=0 }
{
   if (FLAG == 3) {
     FLAG=0
     sub ("   *","")
     sub ("Prct Bound: *","")
     while (sub ("[0123456789]+: +100 *",""))
     sub (" +$","%")
     bound=$0
     if ((hotspare ~ /Enabled/) || (hotspare ~ /Ready/) || (hotspare ~
/Unbound/) || (hotspare ~ /Empty/)) {
       print status,"Disk",disk,hotspare

     }
     else {
       if (hotspare ~ /Binding/) {
	 status="&green"
         print status,"Disk",disk,hotspare,"LUN",bound

       }
       else {
	 status="&yellow"
         print status,"Disk",disk,hotspare,"LUN",rebuild
#         print status,"Disk",disk," Hostspare=",hotspare,"LUN","
Rebuild=",rebuild

       }
     }
   }
   if (FLAG == 2) {
     FLAG=3
     sub ("   *","")
     sub ("Prct Rebuilt: *","")
     while (sub ("[0123456789]+: +100 +",""))
     rebuild=$0
   }
   if (FLAG == 1) {
      sub ("   *","")
      sub ("State: *","")
      status=$0
      FLAG=2
      hotspare=""
      if ($0 ~ /Hot Spare/) {
         sub ("Hot Spare ","",status)
         hotspare="(Hot Spare)"
      }
      if (status ~ /Empty/) {
	hotspare=$status
	status="&clear"
      FLAG=3
      }
      else {
      	if ((status ~ /Enabled/) || (status ~ /Ready/) || (status ~
/Unbound/) || (status ~ /Binding/) || (status ~ /Expanding/)) {
	  hotspare=$status
	  status="&green"
	}
      	else {
             if ((status ~ /Copying/) || (status ~ /Equalizing/)) {
             hotspare=$status
             status="&yellow"
             }
         else {
	  hotspare=$status
	  status="&red"
	}
      }
      }
   }
   if (($0 ~ /Bus +[0-9]+ +Enclosure +[0-9]+ +Disk +[0-9]+/)) {
      sub ("Bus +","")
      sub (" +Enclosure +","_")
      sub (" +Disk +","_")
      disk=$0
      FLAG=1
   }
}' >> $BBTMP/ITC_CLARiiON.OUT.$$

#---[5. Trespass
status]-------------------------------------------------------------
$navicli -h $SPIP getlun -ismetalun -trespass -status  > $BBTMP/$MYTMPFILE
echo -e "\nTrespass Status" >> $BBTMP/ITC_CLARiiON.OUT.$$
echo "----------------------------" >> $BBTMP/ITC_CLARiiON.OUT.$$
$CAT $BBTMP/$MYTMPFILE | $GAWK '
{
      if ($0 ~ /LOGICAL UNIT NUMBER/) {
      sub ("LOGICAL UNIT NUMBER ","")
      lun=$0
#      print "lun=",lun
      }
      else {
           if ($0 ~ /Default Owner/) {
           sub ("Default Owner:              ","")
           preffered_sp=$0
#          print "preferred sp="preffered_sp
           }
           else {
                if ($0 ~ /Current owner/) {
                sub ("Current owner:              ","")
                current_sp=$0
#                print "current_sp=",current_sp
                status="&yellow"
             if ( length(lun) < 4) {
                print status " Lun " lun " -->\t Default
Owner:",preffered_sp," Current Owner:",current_sp
#                print status " Lun"
#		printf "%4s", lun
#		print " -->\t Default Owner:",preffered_sp," Current Owner:",current_sp
                }
                }
           }
     }

}' >> $BBTMP/ITC_CLARiiON.OUT.$$


#---[Check global color output]---
$CAT $BBTMP/ITC_CLARiiON.OUT.$$ | grep \&red > /dev/null 2>&1
ret=$?
if [ "$ret" = "0" ]; then
   COLOR=red
else
   $CAT $BBTMP/ITC_CLARiiON.OUT.$$ | grep \&yellow > /dev/null 2>&1
   ret=$?
   if [ "$ret" = "0" ]; then
      COLOR=yellow
   else
      COLOR=green
   fi
fi
#---[Generate information to send]---
LINE="status $EMC_ARRAY.$TEST $COLOR `date`
`cat $BBTMP/ITC_CLARiiON.OUT.$$`"

#if [ "$COLOR" != "red" ]; then
	$RM -f $BBTMP/ITC_CLARiiON.OUT.$$ $BBTMP/$MYTMPFILE
#fi

#---[Send page info to BBDISPLAY]---
$BB $BBDISP "$LINE

$0 running on `hostname`"
#echo $BB $BBDISP "$LINE"

On Mon, Sep 17, 2012 at 11:37 PM, Vernon Everett
<everett.vernon at gmail.com> wrote:
>
> Hi all
>
> Has anybody done any work on monitoring an EMC Clariion system, that they are prepared to share?
> I have no idea what I need to monitor yet, and we have nothing in place at the moment, so anything is better than what I have now.
>
> All assistance appreciated.
>
> Regards
>     Vernon
>
>
> --
> "Accept the challenges so that you can feel the exhilaration of victory"
> - General George Patton
>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>



More information about the Xymon mailing list