[SunHELP] Howto: SDS Errors via Mail without SunNet Manager

Robert Banniza RPBanniz at ascensionhealth.org
Wed Jun 19 08:01:45 CDT 2002


Here is a script to watch for errors via cron....Courtesy of the SDS
Manual:
 
### Begin Script ###
#
#ident "@(#)metacheck.sh   1.3     96/06/21 SMI"
#
# Copyright (c) 1992, 1993, 1994, 1995, 1996 by Sun Microsystems, Inc.
#
 #
# DiskSuite Commands
#
MDBIN=/usr/sbin
METADB=${MDBIN}/metadb
METAHS=${MDBIN}/metahs
METASTAT=${MDBIN}/metastat
 #
# System Commands
#
AWK=/usr/bin/awk
DATE=/usr/bin/date
MAILX=/usr/bin/mailx
RM=/usr/bin/rm
 #
# Initialization
#
eval=0
date=`${DATE} '+%a %b %e %Y'`
SDSTMP=/tmp/sdscheck.${$}
${RM} -f ${SDSTMP}
 MAILTO=${*:-"root"}   # default to root, or use arg list
 #
# Check replicas for problems, capital letters in the flags indicate an
error.
#
dbtrouble=`${METADB} | tail +2 | \
    ${AWK} '{ fl = substr($0,1,20); if (fl ~ /[A-Z]/) print $0 }'`
if [ "${dbtrouble}" ]; then
        echo ""   >>${SDSTMP}
        echo "SDS replica problem report for ${date}" >>${SDSTMP}
        echo ""   >>${SDSTMP}
        echo "Database replicas are not active:"     >>${SDSTMP}
        echo ""   >>${SDSTMP}
        ${METADB} -i >>${SDSTMP}
        eval=1
fi
 #
# Check the metadevice state, if the state is not Okay, something is
up.
#
mdtrouble=`${METASTAT} | \
    ${AWK} '/State:/ { if ( $2 != "Okay" ) print $0 }'`
if [ "${mdtrouble}" ]; then
        echo ""  >>${SDSTMP}
        echo "SDS metadevice problem report for ${date}"  >>${SDSTMP}
        echo ""  >>${SDSTMP}
        echo "Metadevices are not Okay:"  >>${SDSTMP}
        echo ""  >>${SDSTMP}
        ${METASTAT} >>${SDSTMP}
        eval=1
fi
 #
# Check the hotspares to see if any have been used.
#
hstrouble=`${METAHS} -i | \
    ${AWK} ' /blocks/ { if ( $2 != "Available" ) print $0 }'`
if [ "${hstrouble}" ]; then
        echo ""  >>${SDSTMP}
        echo "SDS Hot spares in use  ${date}"  >>${SDSTMP}
        echo ""  >>${SDSTMP}
        echo "Hot spares in usage:"  >>${SDSTMP}
        echo ""  >>${SDSTMP}
        ${METAHS} -i >>${SDSTMP}
        eval=1
fi
#
# If any errors occurred, then mail the report to root, or whoever was
called
# out in the command line.
#
if [ ${eval} -ne 0 ]; then
        ${MAILX} -s "SDS problems ${date}" ${MAILTO} <${SDSTMP}
        ${RM} -f ${SDSTMP}
fi
 exit ${eval}
### End Script ####
 
Robert Banniza
Senior UNIX Administrator
Ascension Health ISD

>>> Michael Karl <mk at lexcom-net.de> 06/19/02 01:03AM >>>
Hi,

somebody knows a way to send error messages of SDS via mail
without using SunNet Manager?

I don't know the way with SNMP really well.

Thx

Michael
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org 
http://www.sunhelp.org/mailman/listinfo/sunhelp 




NOTE: This e-mail message may contain information that may be privileged, 
confidential, and exempt from disclosure.  It is intended for use only by 
the person to whom it is addressed. If you have received this message in 
error, please do not forward or use this information in any way, delete it 
immediately, and contact the sender as soon as possible by the reply option
or by telephone at the telephone number listed (if available).  Thank you.



More information about the SunHELP mailing list