Skip to content

Instantly share code, notes, and snippets.

@linuxwizard
Created May 26, 2017 02:47
Show Gist options
  • Save linuxwizard/1ed63ca15f4a6b86dc79a5b30c951730 to your computer and use it in GitHub Desktop.
Save linuxwizard/1ed63ca15f4a6b86dc79a5b30c951730 to your computer and use it in GitHub Desktop.
Simple RAID status check script for LSI MegaRAID cards
# Simple RAID status check script for LSI MegaRAID cards
# Needs MegaCli installed. Install from https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip
# Requires sendmail installed
# Create a cron job for auto checks
# Output format
# Degraded 1
# Failed 1
#!/bin/bash
STATUS=`MegaCli -AdpAllInfo -aALL -NoLog|egrep '^ (Degraded|Failed)'|grep -v ' 0'`;
if [ "x$STATUS" != "x" ]; then
echo -e "Subject: RAID WARNING @ `hostname`\n\n$STATUS"|/usr/sbin/sendmail your@email.com
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment