SUMMARY: ODS failures monitoring

From: Michael Pavlov (misha@ml.com)
Date: Tue Jul 01 1997 - 13:54:16 CDT


Well, I guess not that many people care
about the state of their ODS :-)

I received 2 approaches to the metastat output checking.
1st one looks for fields, that should say Okey and sends e-mail if they
don't.
2nd one just checks if the output from this run is diff from the one
before.

Thnx to:
alevin@ltcm.com (Avi J. Levin)
vqh@dwrock.dw.lucent.com (D461-Viet_Q_Hoang(0)82572)

#!/bin/sh
#
# mdcheck - Monitor the metatool devices and check its state
PATH=/bin
if [ ! -d /usr/opt/SUNWmd/sbin ]
then
  echo ODS not installed.
  exit 1
else
  PATH=$PATH:/usr/opt/SUNWmd/sbin
fi
WHOCARES=sun-managers
THISHOST="`uname -n`"
HALFHOUR=1800
while [ 0 -eq 0 ]
do
  FIELDS="`metastat|awk '{if ($1 == "State:"){print $2}else if ($4 !=
"Dbase" && $4 != "" && $1 != "Stripe"){print $4}}'`"
  if [ "$FIELDS" != "" ]
  then
    for FIELD in $FIELDS
    do
      if [ "$FIELD" != "Okay" ]
      then
        echo "The RAID metadevice on $THISHOST has a
problem!"|/usr/ucb/mail -s RAID_FAILURE $WHOCARES
      fi
    done
  fi
  sleep $HALFHOUR
done

#!/bin/csh -f

#
# Run metastat and check the results against an earlier run of metastat.
# If there are any differences, show the output and exit non-zero.
# If there are no differences, remove the output file and exit zero.
#
# This script is meant to be run daily from cron on any machine using
# Online: DiskSuite. There should already be a copy of
# metastat | grep -v 'resync regions'
# in /usr/local/lib/metastat, with a filename equivalent to `hostname`.
#
# Mark Sirota <mark@greenwich.com>, 10/93
#

set src = /etc/adm.d/metastat.`hostname`
set out = /tmp/metastat.`date +%y-%m-%d`

/usr/etc/metastat | grep -v 'resync regions' > $out

cmp -s $src $out
set cmpstatus = $status

if ( $cmpstatus ) then
        cat $out
else
        rm $out
endif

exit $cmpstatus

-- 
      _  _  _	Michael Pavlov
   O /O /O /	DDTS/Sales & Trading
_/\_/\_/\_/	Merrill Lynch, New York
  / \/ \/ \	voice:	(212)236-2062 fax 236-2399
_/ _/\_/\_ \_	alpha:	(800)225-0256 pin 312790



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:58 CDT