Tom Brown wrote: > >> >> Add the following lines before the "echo $OUTPUT" line: >> >> if [ $EXITCODE -eq 0 ]; then >> echo "$OUTPUT" | grep -v CRITICAL >> [ $? -eq 1 ] && EXITCODE=2 >> fi >> >> Totally untested, but should work just dandy. >> >> I'm off to drink an awe inspiring amount of beer and other >> alcohol-based beverages now, so won't see any replies until monday. >> > > bha! end of the script now looks like this > > ### FINALLY... RETRIEVING THE VALUES ### > > EXITCODE=`$SNMPWALK -v 1 -c $COMMUNITY $HOST $STATUS` > [ $DEBUG -gt 0 ] && echo "Retrieve exit code is $EXITCODE" >> $DEBUGFILE > > OUTPUT=`$SNMPWALK -Ovq -v 1 -c $COMMUNITY $HOST $STRING` > [ $DEBUG -gt 0 ] && echo "Retrieve status message is: $OUTPUT" >> > $DEBUGFILE > > if [ $EXITCODE -eq 0 ]; then > echo "$OUTPUT" | grep -v CRITICAL > [ $? -eq 1 ] && EXITCODE=2 > fi > > echo $OUTPUT > exit $EXITCODE > > but when it runs i get this > > ../libexec/retrieve_custom_snmp: line 84: [: -eq: unary operator expected > "CRITICAL emcpowera has 2 dead, 2 alive" >
Urgh. My bad. What does EXITCODE contain when you run it in debug mode? (on a side-note, whoever names a variable containing textual output "EXITCODE" should be shot) > ho hum - enjoy the beer > Good plan. Working on it ;-) -- Andreas Ericsson [EMAIL PROTECTED] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null