Sunday, October 16, 2005

nagios plugin script for checking status of mirrored drives via nrpe.

Following script need to be defined in both nagios comamnds and nrpe agent on the client side

#!/bin/bash
# Copyright (c) 2005 Opengaming Israel, Naor Weissmann
# operations: check if all metastat unitx are operational.
#
RETSTR="initial"
RETVAL=0
youtput=`metastat |grep -i stat |grep 'State:' |grep -v 'Okay' |wc -l`

if [ $youtput -eq 0 ]; then
RETVAL=0
RETSTR="OK - All metadevices are stable"
else
RETVAL=2
RETSTR="ERROR - Metadevices need Maintainence"
fi

echo $RETSTR
exit $RETVAL

No comments: