#!/bin/ksh # # Author: Todd Barbera # Date: 10/29/05 # Purpose: Verify the status of 'raidctl' and report # back to nagios. Must set suid or configure sudo. # . /usr/local/nagios/libexec/utils.sh /usr/sbin/raidctl | grep c1 | while read line do set -f $line if [ $# = 4 ]; then volume=`echo $1` volstat=`echo $2` disk1=`echo $3` disk1stat=`echo $4` else disk2=`echo $1` disk2stat=`echo $2` fi done if [ "$volstat" != "OK" ]; then errmsg=`echo WARNING: Volume $volume is $volstat.` exitstatus=$STATE_WARNING fi if [ "$disk1stat" != "OK" ]; then errmsg=`echo $errmsg Disk $disk1 is $disk1stat.` exitstatus=$STATE_WARNING fi if [ "$disk2stat" != "OK" ]; then errmsg=`echo $errmsg Disk $disk2 is $disk2stat.` exitstatus=$STATE_WARNING fi if [ "$exitstatus" = "$STATE_WARNING" ]; then echo $errmsg exit $exitstatus else echo Volume $volume is OK. exit $exitstatus fi