Unknown code while code should be OK



I wrote a small perl program for Nagios, which checks if the Queue manager is up and running.
That script works, and also gives an exit 0.

When I run the perl command from shell (perl -w), it’s giving the following output:

Connection to MQ: OK

And gives an exit 0.

In the Nagios window you can also see that text 'Connection to MQ: Ok’
But it always gives the state ‘unknown’

Can somebody help me ?



My only suggestion would be to look at how the other perl plugins pass info to nagios. Perhaps you have no definition of what “OK” status is. That way, if the check results in exit 0, then $status or some variable will be set to “OK”.


I copied that from other plugins, and the state is ‘ok’. I also tried this with exit 0, but same result.


if i’m not wrong you can parse the output as a regex on some plugins… don’t know if this helps much…



This person in the following thread had the same sort of trouble. Check it out.