Friday, February 11, 2011

Monitor soft-raid in Linux

Create a script like this:

#!/bin/bash
ADMIN="xxx@mail.com"
HOSTNAME=`/bin/hostname`

if egrep "\[.*_.*\]" /proc/mdstat > /dev/null
then
logger -p daemon.error "mdcheck: Failure of one or more software RAID devices"
echo "Failure of one or more software RAID devices on ${HOSTNAME}" | /bin/mail -s "$0: Software RAID device failure on ${HOSTNAME}" ${ADMIN}
fi

No comments:

Post a Comment