Here’s a Bash script to check software RAID that will send an e-mail reporting the array status:
#!/bin/bash
# check_raid.sh
EMAIL="your@email.com"
if egrep "\[.*_.*\]" /proc/mdstat > /dev/null
then
logger -s "mdcheck: RAID devices ERROR"
echo "Software RAID devices ERROR on ${HOSTNAME}" | /bin/mail -s \
"$0: Software RAID devices ERROR on ${HOSTNAME}" ${EMAIL}
else
logger -s "mdcheck: RAID devices OK"
echo "Software RAID devices OK on ${HOSTNAME}" | /bin/mail -s \
"$0: Software RAID device OK on ${HOSTNAME}" ${EMAIL}
fi