#/bin/sh! # -------------------------------------- # Stefano Vicenzoni 28-01-2008 # # in Nagios directory define checkcommands line: # # define command{ # command_name Check_array_5300 # command_line $USER1$/Check_array_5300 $HOSTADDRESS$ $ARG1$ # } # # and in service # # define service{ # use generic # host_name hostname # service_description yourdescription # check_command Check_array_5300!X # } # where X = number of logical array (0 or 1 or 2..) # # # Tested with controller SMART ARRAY 5300 on Windows Server with snmp active. # # HOST=$1 OK=$2 WARN=$3 CRIT=$4 RETVAL=0 # # modify next line with your community !! # UNIT=`/usr/bin/snmpwalk -v 1 -c COMMUNITY -On $1 SNMPv2-SMI::enterprises.232.3.2.3.1.1.4.5.$2 | tail -1 | awk '{print \$4}'` RETVAL=$? # if [ $UNIT = 2 ]; then echo "Array status OK" RETVAL=0 else echo "Array errors!! Check Status code: $UNIT" RETVAL=2 fi exit $RETVAL