Created
December 15, 2020 08:22
-
-
Save joho1968/21b08843a959e1e69bed32a6cdbc5566 to your computer and use it in GitHub Desktop.
Checking LSI RAID storage status in Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Check LSI RAID storage status | |
# | |
# This will trigger on the output NOT being "Optl" (Optimal). This works for me, | |
# your mileage may vary. One problem in using more "verbose output" from the | |
# storcli64 binary is that it always (?) outputs some sort of legend with all | |
# the various status types explained, so it always contains the text "Degraded" | |
# for example. This minor script will simply search for what we want, which is | |
# a RAID in optimal state, and if NOT found, perform a full status scan and send | |
# it as an e-mail message to wherever it needs to be sent. | |
# | |
# Joaquim Homrighausen <[email protected]> | |
# 2020-12-15 | |
# | |
STATUS=`/usr/local/bin/storcli64 /c0 /v0 show nolog |egrep "RAID6 Optl"`; | |
EGREP=$? | |
if [ "$EGREP" -ne 0 ] | |
then | |
[email protected] | |
STATUS=`/usr/local/bin/storcli64 /c0 show`; | |
/usr/sbin/sendmail -i $TO <<MAIL_END | |
From: [email protected] | |
To: $TO | |
Subject: RAID WARNING @ `hostname` | |
$STATUS | |
MAIL_END | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment