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="email@example.com firstname.lastname@example.org" if grep -q "(F)" /proc/mdstat; then cat /proc/mdstat | /usr/bin/mutt -s "$SUBJECT" $EMAIL fi