DIQ'S DEN - WWW.COUYON.NET
  • Home
  • Blog
  • Photos

Monitoring Intel SSD health behind a Dell PERC RAID card

3/2/2012

 
In my last post, I ventured into the topic of monitoring individual SSD health using Intel's SMART stats, specifically, the Media_Wearout_Indicator. I contrasted this to someone's approach of monitoring for total number of bytes written. In the post, I also threw out the idea of monitoring these counters with smartd. Well, smartd wouldn't do what I wanted it to do (watch this counter and throw a fit if it dropped below a value). Sooooo, I did what any UNIX admin would do and replaced it with a shell script. We use OpenNMS and NRPE to trigger commandlets like this, so here's the script I wrote. It should work in Nagios, too. You'll probably have to customize the script to your liking, but it's straightforward and has some easy to tweak variables in the beginning. If you can't figure these variables out, time find a new line of work.

Full inline script after the jump (if you want to see what you can download).
ssdhealth.sh
File Size: 0 kb
File Type: sh
Download File

#!/bin/bash

DISKS=( sda sdb sdc )
NUMDRIVES=8
SMARTCTL="/usr/sbin/smartctl"

SSDPRESENT=0

for disk in "${DISKS[@]}"; do
  for i in $(seq 0 ${NUMDRIVES-1}); do
    if [ `/usr/bin/sudo -n $SMARTCTL -A --device=sat+megaraid,$i /dev/$disk | grep -c "Media_Wearout_Indicator"` -eq 1 ]; then
      SSDPRESENT=1
      if [ `/usr/bin/sudo -n $SMARTCTL -A --device=sat+megaraid,$i /dev/$disk | grep "Media_Wearout_Indicator" | awk '{print $4}'` -lt 20 ]; then
        echo "CRITICAL: SSD $i IN $DISK FAILING!"
        exit 1
      fi
    fi
  done
done

if [ $SSDPRESENT -eq 1 ]; then
  echo "OK: All SSD pass"
  exit 0
else
  echo "CRITICAL: No SSD present"
  exit 1
fi

Comments are closed.

    Author

    A NOLA native just trying to get by. I live in San Francisco and work as a digital plumber for the joint that runs this thing. (Square/Weebly) Thoughts are mine, not my company's.

    Picture
    Moi

    Archives

    May 2021
    April 2021
    March 2021
    February 2021
    December 2019
    April 2019
    July 2018
    February 2018
    January 2017
    August 2016
    May 2016
    June 2015
    May 2015
    December 2014
    July 2014
    March 2014
    December 2013
    November 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    October 2012
    July 2012
    June 2012
    April 2012
    March 2012
    February 2012
    November 2011
    September 2011
    August 2011
    June 2011
    May 2011

    Categories

    All
    Cajun
    Computers And Internet
    Cooking
    Creole
    Food
    Gumbo
    Nola
    Recipe
    Sf

    RSS Feed

Proudly powered by Weebly
  • Home
  • Blog
  • Photos