Skip to content

Instantly share code, notes, and snippets.

@joho1968
Created December 15, 2020 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joho1968/21b08843a959e1e69bed32a6cdbc5566 to your computer and use it in GitHub Desktop.
Save joho1968/21b08843a959e1e69bed32a6cdbc5566 to your computer and use it in GitHub Desktop.
Checking LSI RAID storage status in Linux
#!/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 <joho@webbplatsen.se>
# 2020-12-15
#
STATUS=`/usr/local/bin/storcli64 /c0 /v0 show nolog |egrep "RAID6 Optl"`;
EGREP=$?
if [ "$EGREP" -ne 0 ]
then
TO=my.email@address.ext
STATUS=`/usr/local/bin/storcli64 /c0 show`;
/usr/sbin/sendmail -i $TO <<MAIL_END
From: root@my.monitored.server
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