Check for degraded RAID

A simple script to check for a degraded software RAID that uses mdadm. This will check and email you if a degraded RAID is found.

#!/bin/bash
 
# Checks the software RAID status. Sends email if they are degraded.
# To add more people, just append their name to the EMAIL field, seperated 
# by a space inside the quotations.
 
SUBJECT="SERVERNAME: Degraded RAID"
EMAIL="admin1@example.com admin2@example.com"
 
if grep -q "(F)" /proc/mdstat; then
	cat /proc/mdstat | /usr/bin/mutt -s "$SUBJECT" $EMAIL
fi

Leave a Reply

Your email address will not be published. Required fields are marked *