Here's a script that came from somewhere...I run it from crontab like this
(it emails root automagically if there's any output):
15 * * * *      /usr/local/bin/checkmd -v

#! /bin/bash
#
# This script checks that the md configuration is the same as that
# read at configuration time.  When called with the -i option, it
# reads /proc/mdstat and learns the configuration.  If called without
# args, it returns non zero status if the configuration is different
# from the one learned, and prints a message if the -v flag is present.
#
# usage: checkmd.sh [-iv]

init=""
verbose=""
CONF=/etc/md.conf

while getopts "iv" opt; do case $opt in
    i)
init=true
;;
    v)
verbose=true
;;
    *)
cat <<-EOF
usage: $0 [-iv] [fromdev] [todev]
    -i means init the file $CONF with the current md configuration
    -v means display a message in case of configuration mismatch
EOF
exit 1
;;
esac; done

if [ ! -r $CONF -o "$init" = true ]; then
    cat /proc/mdstat > $CONF
    chmod 444 $CONF
    echo "Current configuration saved in $CONF:" >&2
    cat $CONF >&2
else
    cat /proc/mdstat | cmp $CONF >/dev/null
    if [ $? != 0 ]; then
if [ $verbose ]; then
    echo >&2
    echo "ALARM! md configuration problem" >&2
    echo >&2
    echo "Current configuration is:" >&2
    cat /proc/mdstat >&2
    echo >&2
    echo "should be:" >&2
    cat $CONF >&2
fi
    exit 1
    fi
fi



________________________________________
Michael D. Black   Principal Engineer
[EMAIL PROTECTED]  407-676-2923,x203
http://www.csi.cc  Computer Science Innovations
http://www.csi.cc/~mike  My home page
FAX 407-676-2355
-----Original Message-----
From: Theo Van Dinter <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, February 05, 1999 5:43 PM
Subject: RAID monitor?


Just curious--

has anyone written a generic "monitor" script that checks the status of the
RAID arrays currently in use?  something that might mail if there's an
error?

I started working on one, but don't want to reinvent the wheel.

--
Randomly Generated Tagline:
If it's useless, it will have to be documented.




Reply via email to