Created
April 12, 2013 22:29
-
-
Save sixty4k/5375705 to your computer and use it in GitHub Desktop.
megacli to graphite
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 | |
# set my hostname | |
HOSTNAME=`hostname -s` | |
# Set Graphite host | |
GRAPHITE=your.graphite.instance | |
GRAPHITE_PORT=2003 | |
# Iterate through all the disks (polling live from the raid controller) | |
for i in `/opt/MegaRAID/MegaCli/MegaCli64 -PDList -a1 | grep -A 1 "Enclosure Device ID" | cut -d: -f2 | grep -v '\-\-' | sed -e '$!N; s/\n /:/'` | |
do | |
# remove the colon from the disk id for easier graphite naming | |
DISK=`echo $i | sed -e 's/:/-/'` | |
DATE=`date +%s` | |
/opt/MegaRAID/MegaCli/MegaCli64 -PDInfo -PhysDrv [$i] -a1 | grep -A 3 "Media Error Count" | sed -e 's/ //g' | sed -e "s/^/${HOSTNAME}\.megacli\.${DISK}\./" | sed -e 's/:/ /' | sed -e "s/$/ ${DATE}/" | nc $GRAPHITE $GRAPHITE_PORT | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will get you:
MediaErrorCount
OtherErrorCount
PredictiveFailureCount
LastPredictiveFailureEventSeqNumber (if this is going up, fail that drive yo)