Hi
I have wrote a bash script which is checking pps for a Cisco platform. The problem is that Nagios shows me (null) in “Status Field” ?! I don’t understand why. When I start the script I get the proper output which, as I understand, should be placed int the Status Field. Any ideas why is that.
The rights on the file are 777 so it is not a problem. Below is the script:
#! /bin/bash
snmpIfDescr=‘1.3.6.1.2.1.2.2.1.2’;
snmpLocifInPktsSec=‘1.3.6.1.4.1.9.2.2.1.1.7’;
snmpLocifOutPktsSec=‘1.3.6.1.4.1.9.2.2.1.1.9’;
snmpwalk $1 -v 2c -c $2 $snmpIfDescr | grep Gigabit | awk -F. ‘{print $2}’ | awk -F= ‘{print $1}’ >temp_wynik
i=0
InPPS=0
OutPPS=0
TempInPPS=0
TempOutPPS=0
WarnIn=$3
WarnOut=$4
CritIn=$5
CritOut=$6
while read; do
i=$(($i+1))
TempInPPS=snmpwalk $1 -v 2c -c $2 $snmpLocifInPktsSec.$REPLY | awk '{print $4}'
TempOutPPS=snmpwalk $1 -v 2c -c $2 $snmpLocifOutPktsSec.$REPLY | awk '{print $4}'
InPPS=$(($TempInPPS+$InPPS))
OutPPS=$(($TempOutPPS+$OutPPS))
done<temp_wynik
#echo $InPPS
#echo $OutPPS
rm temp_wynik
if ((( “$InPPS” > 0 && “$InPPS” < “$WarnIn” )) || (( “$OutPPS” > 0 && “$OutPPS” < “$WarnOut” )));
then
echo "The Input/Outpu PPS Level is OK"
stateid=0
elif ((( “$InPPS” > “$WarnIn” && “$InPPS” < “$CritIn” )) || (( “$OutPPS” > “$WarnOut” && “$OutPPS” < “$CritOut” )));
then
echo "Warning Input: $InPPS / Output: $OutPPS PPS Level "
stateid=1
elif (( “$InPPS” > “$CritIn” && “$OutPPS” > “$CritOut” ));
then
echo "Critical Input: $InPPS / Output: $OutPPS PPS Level"
stateid=2
fi
exit $stateid