[Xymon] Clariion monitoring

Nico nicolas at lienard.name
Fri Sep 21 21:36:55 CEST 2012


here exactly the same script that we use also but with minor tweaks we did.

you have to add a tag on the device configuration in hosts.cfg : emcstorage
you can use emcstorage:EXCLUDE=[A0|A1|A2|B0|B2|B1] to exclude the port A0 A1 A2 B0 B2 B1 for instance.


#!/bin/bash 

# 
#
##--[special env]----
echo -n "Start "
date

navicli=/opt/xymon/server/ext/emc/navicli       # Where is the NAVICLI cmd
GAWK=/bin/awk                           # need GNU AWK
TEST="hardware"                                                                 # The BB test name


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


xymongrep emcstorage* | while read ligne
do
SPIP=`echo $ligne | awk '{print $1}'`
EMC_ARRAY=`echo $ligne | awk '{print $2}'`

# patch nli cf down (cf lines 117)
PORTS_EX=`echo $ligne | grep EXCLUDE | sed "s/.*EXCLUDE=\[\(.*\)\]/\1/"`
PORTS_EX=`echo $PORTS_EX | sed 's/|/ /g'`

TEST="hardware"                                                                 # The XYMON test name
MYTMPFILE=CLARIION_STATUS.$$                    # Use a buffer tmp file for NAVICLI output
XYMONPROG=XYMON_CLARiiON; export XYMONPROG      # ??? 


#---[1. Get cache status]---------------------------------------------------------
$navicli -h $SPIP getcache > $XYMONTMP/$MYTMPFILE
$CAT $XYMONTMP/$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    
  }
  }
}' > $XYMONTMP/ITC_CLARiiON.CACHE.OUT.$$
#---[Check global color output]---
$CAT $XYMONTMP/ITC_CLARiiON.CACHE.OUT.$$ | grep \&red > /dev/null 2>&1
ret=$?
if [ "$ret" = "0" ]; then
  COLOR=red
else
  COLOR=green
fi
#---[Generate information to send]---
LINE="status $EMC_ARRAY.cache $COLOR `date`
`cat $XYMONTMP/ITC_CLARiiON.CACHE.OUT.$$`"
echo $EMC_ARRAY
cat $XYMONTMP/ITC_CLARiiON.CACHE.OUT.$$
$XYMON $BBDISP "$LINE"
rm $XYMONTMP/ITC_CLARiiON.CACHE.OUT.$$



#---[2. Port status]--------------------------------------------------------------
$navicli -h $SPIP port -list > $XYMONTMP/$MYTMPFILE
$CAT $XYMONTMP/$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 {
              sub ("Status:.*","\\&red")
           }              
           LinkS=$0           
        }
        if ($0 ~ /Port Status/) {
           if ($0 ~ /Status:Online/) {
              sub ("Status:Online","\\&green")
           } else if ( $0 ~ /Status:DISABLED/ ) {
              # port not activated, link down -> ok , gch 20080327
              sub ("red","green",LinkS)
           } else {
              sub ("Status:.*","\\&red")
           }              
           sub ("Port","Status")
           PortS=$0           
           sub ("Status:","",PortS)
           sub ("Status:","",LinkS)
           print SP,Port,PortS,LinkS
        }
     }
  }
}' > $XYMONTMP/ITC_CLARiiON.PORT.OUT.$$

# patch nli (ubber crado)
for ex in $PORTS_EX
do
       SP=`echo $ex | sed 's/\([A-Z]\).*/\1/'`
       PORT=`echo $ex | sed 's/.*\([0-9]\)/\1/'`
       EXCLUDE="SP $SP Port $PORT"
       grep -v "$EXCLUDE" $XYMONTMP/ITC_CLARiiON.PORT.OUT.$$ > $XYMONTMP/ITC_CLARiiON.PORT.OUT.$$.new
       mv $XYMONTMP/ITC_CLARiiON.PORT.OUT.$$.new $XYMONTMP/ITC_CLARiiON.PORT.OUT.$$
done


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



#---[3. DPE/DAE Status]-----------------------------------------------------------
$navicli -h $SPIP getcrus > $XYMONTMP/$MYTMPFILE
$CAT $XYMONTMP/$MYTMPFILE | $GAWK '
{
  if (($0 ~ /[DPE|DAE] Bus . Enclosure ./) || ($0 ~ /State/)) {
     if ($0 ~ /State/) {
        sub ("Bus . Enclosure . ","")
        sub ("   *"," ")
        sub ("Power","Power Supply")
        if ($0 ~ /State: Valid/) {
           sub ("Valid","Present")
        }
        if ($0 ~ /State: Present/) {
           sub (" State: Present","")
           sub ("^","\\&green ")
        }
        else {
           sub (" State:.*","")
           sub ("^","\\&red ")
        }           
     }
     if ($0 ~ /[DPE|DAE] Bus . Enclosure ./) {
        print ""
     }

     print
     if ($0 ~ /[DPE|DAE] Bus . Enclosure ./) {
       print "----------------------------"
     }
  }   
}' > $XYMONTMP/ITC_CLARiiON.HARD.OUT.$$
#---[Check global color output]---
$CAT $XYMONTMP/ITC_CLARiiON.HARD.OUT.$$ | grep \&red > /dev/null 2>&1
ret=$?
if [ "$ret" = "0" ]; then
  COLOR=red
else
  COLOR=green
fi
#---[Generate information to send]---
LINE="status $EMC_ARRAY.hardware $COLOR `date`
`cat $XYMONTMP/ITC_CLARiiON.HARD.OUT.$$`"
$XYMON $BBDISP "$LINE"
rm  $XYMONTMP/ITC_CLARiiON.HARD.OUT.$$




#---[4. Disks status]-------------------------------------------------------------
$navicli -h $SPIP getdisk -state > $XYMONTMP/$MYTMPFILE
$CAT $XYMONTMP/$MYTMPFILE | $GAWK ' BEGIN { FLAG=0 }
{
  if (FLAG == 1) {
     sub ("   *","")
     sub ("State:","")
     status=$0
     FLAG=0
     hotspare=""
     if ($0 ~ /Hot Spare/) {
        sub ("Hot Spare ","",status)
        hotspare="(Hot Spare)"
     }
     if (status ~ /Empty/) { status="&clear" }
     else {
       if ((status ~ /Enabled/) || (status ~ /Ready/) || (status ~ /Unbound/) || (status ~ /Binding/)) { status="&green" }
       else { status="&red" }
     }
     print status,"Disk",disk,hotspare

  if (FLAG == 1) {
     sub ("   *","")
     sub ("State:","")
     status=$0
     FLAG=0
     hotspare=""
     if ($0 ~ /Hot Spare/) {
        sub ("Hot Spare ","",status)
        hotspare="(Hot Spare)"
     }
     if (status ~ /Empty/) { status="&clear" }
     else {
       if ((status ~ /Enabled/) || (status ~ /Ready/) || (status ~ /Unbound/) || (status ~ /Binding/)) { status="&green" }
       else { status="&red" }
     }
     print status,"Disk",disk,hotspare

  }
  if (($0 ~ /Bus +[0-9]+ +Enclosure +[0-9]+ +Disk +[0-9]+/) && (FLAG == 0)) {
     sub ("Bus +","")
     sub (" +Enclosure +","-")
     sub (" +Disk +","-")
     disk=$0
     FLAG=1
  }
}' > $XYMONTMP/ITC_CLARiiON.DISK.OUT.$$
#---[Check global color output]---
$CAT $XYMONTMP/ITC_CLARiiON.DISK.OUT.$$ | grep \&red > /dev/null 2>&1
ret=$?
if [ "$ret" = "0" ]; then
  COLOR=red
else
  COLOR=green
fi
#---[Generate information to send]---
LINE="status $EMC_ARRAY.disks $COLOR `date`
`cat $XYMONTMP/ITC_CLARiiON.DISK.OUT.$$`"
$XYMON $BBDISP "$LINE"
rm  $XYMONTMP/ITC_CLARiiON.DISK.OUT.$$


rm $XYMONTMP/$MYTMPFILE
done



Le 21 sept. 2012 à 17:15, Scott Pfister a écrit :

> 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
>> 
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon




More information about the Xymon mailing list