To all.
Thanks for those who responded:
John Speno
Orn Asgeirsson
MArk Baldwin
Don Bodle
I have included the scripts that I have received and again, many thanks.
The following script is from Don Boddle:
#!/usr/bin/sh
# ------------------------------------------------------------
#
# File : meta-check
#
# Description : reviews output of metastat command for
# hot spares in use.
#
# Author: Don Bodle, C.E.T.A.
#
# Date: 19 Dec 1997
#
# Notes: Placed in hcdeb's cron for checking periodically
# --------------------------------------------------------------
#
/usr/opt/SUNWmd/sbin/metastat | /usr/bin/awk '
BEGIN { found = 0 }
/Hot Spare/ { found = NR + 1
}
{ if ( NR >= found && found != 0) if ( $2 == "In" ) {
printf("Hot Spare %s is %s %s \n",$1,$2,$3)
}
}' > /tmp/meta-check.tmp
# originally just piped output to mailx, but would generate mail always.
# to prevent mailing empty messages with just subject line, temp file was
# used. If file isn't empty, send message. Otherwise just remove file.
#
if [ -s /tmp/meta-check.tmp ]
then
/usr/bin/mailx -c mes@mead.com -s"Metastat report" hcdeb@mead.com <
/tmp/meta-
check.tmp
fi
rm /tmp/meta-check.tmp
The following script is from Mark Baldwin:
#!/bin/sh
if [ -f /var/log/md.log ]; then
mv /var/log/md.log /var/log/md.log.old fi
if [ -f /usr/opt/SUNWmd/sbin/metastat ]; then /usr/opt/SUNWmd/sbin/metastat
|grep -i maint > /var/log/md.log elif [ -f /usr/etc/metastat ]; then
/usr/etc/metastat |grep -i maint > /var/log/md.log fi
if
test -s /var/log/md.log; then
mailx -s "`uname -n` metastat problem report" root < /var/log/md.log; else
exit 0;
fi
The following script is from Orn Asgeirsson:
This his already been covered, see the archives.
I use this:
0,30 * * * * /etc/ods_check > /dev/null
#!/bin/sh
# /etc/ods_check
# 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=root@domain
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
echo "The mirror metadevice on $THISHOST has a problem!"|/usr/ucb/mail
-s "**** MIRROR FAILIURE !! ****" $WHOCARES
fi
done
fi
# sleep $HALFHOUR
#done
The following script is from John Speno:
I wrote a small script which runs periodically from cron. It compares
the current output of metastat with a master copy which gets created
when everything is working.
If there are differences (checked using plain old diff), it sends me
e-mail.
Here's it:
#!/bin/sh
PATH=/usr/bin:/usr/opt/SUNWmd/sbin
STATE=/usr/local/lib/metacheck/master.state
NEW=/usr/local/lib/metacheck/latest.state
# This defines who gets e-mail when there is a problem
ADMIN=your-email-address-goes-here
# see if metacheck has already checked, # and no one has fixed the
problems yet. if [ -f $NEW ]
then
exit 0
fi
# do we have a state file to compare to? if [ ! -f $STATE ]
then
echo "Can't read $STATE, giving up"
exit 1
fi
# check for differences in the metastat output metastat > $NEW
if [ ! -f $NEW ]
then
echo "Can't read $NEW, did metastat run?" exit 1
fi
diff $STATE $NEW >/dev/null 2>&1
# if things have changed, send a warning if [ $? -eq 1 ]
then
mailx -s "Metacheck detected changes" $ADMIN < $NEW
else
rm $NEW
fi
exit 0
______________________________ Reply Separator _________________________________
Subject: Notification of DiskSuite 4.1 error message
Author: Mark_Conroy@em.fcnbd.com at Internet
Date: 7/28/98 7:47 AM
Question for the group,
We have been using Sun Enterprise Volume Manager on several of our
machine and we like the way that we receive notification when a disk
fails(currently, we have a .forward file set up so that any error
message sent by Volume Manager, that sends a mail to root, it is
forwarded to our individual cc-mail addresses.
We have installed DiskSuite 4.1 on a couple of machines, and we
receive no notification. I went to the manual(novel idea), and there
is a section identifying that we can have snmp traps sent to a
management station or there was a reference to setting up a script to
have messages sent to root's mail. I would prefer to have it go to
root, and was wondering if anyone had already set up any scripts, for
notification of when a disk fails, or automatic switch over to hot
spares has occurred, and would be willing to share.
Just a thought.
Thanks in advance.
Mark Conroy
Will summerize....
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:45 CDT