Page 1 of 1
No output returned from plugin
Posted: Thu Dec 07, 2017 5:57 am
by enas
Is there a way to treat the message "No output returned from plugin" as WARNING or CRITICAL state. In my Nagios XI it is judged as OK. Thanks.
Olaf
Re: No output returned from plugin
Posted: Thu Dec 07, 2017 10:59 am
by npolovenko
Hello,
@enas. Do you know why the plugin isn't returning any output? I'd say this is an unusual behavior. As far as return states, you will probably need to modify the source code. You can take a look at this Development guideline for a better understanding:
http://nagios-plugins.org/doc/guidelines.html
Also, can you upload the plugin here? If the source code is easy enough to be changed in a few minutes I may be able to help you fix it.
Re: No output returned from plugin
Posted: Fri Dec 08, 2017 3:52 am
by enas
Hello,
the reason why I'm asking is that: I monitored APC UPS in the past. Now we replaced them by Eaton UPS. I changed some of the OIDs and got OK results. But the other Tests unexpectedly were looking OK as well even with no output from the plugin. I would have to adjust the OIDs.
But it would be great if Nagios would show in such a case a state of UNKNOWN instead of OK. One would possibly oversee the problems.
Is there a way to tell Nagios: set a "No output" result as UNKNOWN?
Thanks
Olaf
Re: No output returned from plugin
Posted: Fri Dec 08, 2017 10:42 am
by npolovenko
@enas, Are you using the check snmp plugin? Can you check the version number?
Code: Select all
cd /usr/local/nagios/libexec/
./check_snmp --help
You should see the version number at the top.
Please also send us the command that you're running and the returned output. A screenshot of an empty output in XI may be helpful as well.
Re: No output returned from plugin
Posted: Mon Dec 11, 2017 4:31 am
by enas
In the screenshot of Nagios view you can see, what I meant. In the upper lines there is no output with an UNKNOWN state. That's what I would expect. But in the lowest lines you see also "No output" but with a OK state. That's what I like to prevent.
BTW, the plugin is self-written. I have 4 UPS identically configured in Nagios. With one of the UPS I get these UNKNOWN failures. When testing in bash under user nagios the plugin works:
[nagios@nagios libexec]# ./check_eaton_ups.sh -H enspw2-1 -l -c 60 -w 50
OK - Output load is at 35 % of rated capacity.
When testing from CCM I'm getting also a result. (second screenshot)
But the Nagios view shows me "Could not get value ..". Why?
The only log entry I could find is:
Dec 11 09:44:50 nagios nagios: SERVICE ALERT: enspwe-1.intern.enas.fraunhofer.de;checks ups battery state prio2;UNKNOWN;HARD;4;UNKNOWN - Batterytest has unexpected state. ()
Re: No output returned from plugin
Posted: Mon Dec 11, 2017 10:27 am
by mcapra
enas wrote:Is there a way to treat the message "No output returned from plugin" as WARNING or CRITICAL state.
...
But in the lowest lines you see also "No output" but with a OK state. That's what I like to prevent.
Strictly speaking, this scenario should be handled in your plugin's logic. Allowing Nagios Core to determine status codes beyond what was returned as the exit code is a whole can of worms that could lead to some poor design patterns in community plugins. Just my 2 cents on that topic.
As to why this is happening with your plugin,
awk and
sed both strip the unix exit codes of the original command that is piped in (credit to
@Box293 for teaching me this). I notice your plugin uses
awk extensively. Unless you're feeding
awk total junk, it's going to always return 0 for the exit code regardless of what happened in the
snmpget.
As one potential solution, you could leverage Bash's
$PIPESTATUS variable to make sure you aren't losing your
snmpget exit codes once they're passed into
awk. Like so:
https://stackoverflow.com/questions/122 ... us-in-bash
I haven't looked thoroughly at the plugin, and I'm not really a Bash guy, so perhaps you've already addressed this. I thought it was worth mentioning anyway

Re: No output returned from plugin
Posted: Mon Dec 11, 2017 10:48 am
by npolovenko
@enas, In addition to
@mcapra post, i'd like to add that in CCM you may select the "initial state" for this particular service.
screenshot-192.168.4.172-2017-12-11-09-43-37-546.png
You may choose Warning or Critical, and that should force the service state to be Warning or Critical unless the plugin actually returns a different status code.