unix

How do I create a Nagios or Icinga plugin to monitor the RAID card on my HP Proliant DL360 G7 server?

Setting up a script to monitor your RAID array is very useful.

The script below will report the status and go into critical state if the 7th field is not “OK”.

#!/usr/local/bin/bash

LOG=/tmp/raid_status.out

sudo /usr/sbin/hpacucli ctrl slot=0 logicaldrive all show status > $LOG

if [ $(awk ‘$7==”OK”‘ $LOG | wc -l) -eq 1 ]
then
echo “OK: $(awk ‘$7==”OK” {print}’ $LOG | sed ‘s!^ *!!g’)”
exit 0
else
echo “CRITICAL: $(awk ‘/logicaldrive/{print}’ /tmp/raid_status.out)”
exit 2
fi

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top