I have a very simple bash script to check the fan state of my Cisco switch. I can run the script from the command prompt with './' and it returns the correct values; however, when I build my command string and enable the check it blows past if condition 1 and if condition 2, and odd part about it... Nagios has my check as showing "warning", and the text as CHECK FAILED, which is the unknown status.
Code: Select all
#!/bin/bash
yes=0
warn=1
err=2
un=3
test=$(snmpget -v2c -c trustedzone 192.168.14.34 CISCO-ENVMON-MIB::ciscoEnvMonFanState.5007 | awk '{print $4}')
if [ "$test" = "normal(1)" ]; then
echo "OK - 1"
return "$yes"
elif
[ "$test" = "critical(3)" ]; then
echo "CRITICAL - 2"
return "$err"
else
echo "CHECK FAILED"
return "$un"
fiThank you
/JJ/