Skip to content

Instantly share code, notes, and snippets.

@sixty4k
Created April 12, 2013 22:29
Show Gist options
  • Save sixty4k/5375705 to your computer and use it in GitHub Desktop.
Save sixty4k/5375705 to your computer and use it in GitHub Desktop.
megacli to graphite
#!/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
@sixty4k
Copy link
Author

sixty4k commented Apr 12, 2013

This will get you:
MediaErrorCount
OtherErrorCount
PredictiveFailureCount
LastPredictiveFailureEventSeqNumber (if this is going up, fail that drive yo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment