[Nagiosplug-help] Helprequest about Plugin Return Codes

Andreas Ericsson ae at op5.se
Tue Jun 28 04:09:33 CEST 2005


Hendrik Baecker wrote:
> Hi Tony,
> 
> I know the guidelines, my question was: Why does the check_nagios Plugin
> don't deal with these guidelines and returns exit codes like 0 for OK,
> 256 for Warning and 512 for Critical?
> 

It only seems that way that if you don't use the WEXITSTATUS() macro, 
which right-shifts the exit-status by 8 and masks off the lower 8 bits 
of the shifted result, making the exit-status an 8-bit integer (-128 - 
127 or 0-255, depending on signedness).

Considering you're not a programmer (you said so yourself), it's strange 
that you've managed to get the unmasked, unshifted exit-status. You 
should either learn to program or not fiddle with popen() calls and the 
likes.

> Anthony Montibello schrieb:
> 
> 
>>as per the Nagios Plugin Development Guide:
>>http://nagiosplug.sourceforge.net/developer-guidelines.html
>>
>>Plugins should return 
>>0 for OK
>>1 for Warning
>>2 for Critical
>>3 for unknown/execution error
>>
>>
>>Good Luck
>>TOny
>>
>>
>>
>>On 6/28/05, Hendrik Baecker <b00mer at gmx.net> wrote:
>> 
>>
>>
>>>Hi List,
>>>   
>>>
>>
>>at the moment I am writing on some tools for detecting an offline
>> 
>>
>>
>>>nagios
>>>   
>>>
>>
>>server when runnung two Nagios Server in redundance.
>>
>>My plan is to
>> 
>>
>>
>>>write a little tool that executes a check_nrpe to connect
>>>   
>>>
> 
>>from the backup to
> 
>> 
>>
>>
>>>the master to execute there a check_nagios.
>>>   
>>>
>>
>>My tool works so far that I can
>> 
>>
>>
>>>see the Pluginoutput and the exit code.
>>>   
>>>
>>
>>But I am wondering that the exitcode
>> 
>>
>>
>>>for a WARNING is 256 and for
>>>   
>>>
>>
>>CRITICAL 512.
>>
>>As far as I remember the return
>> 
>>
>>
>>>codes for Plugins should be between 0
>>>   
>>>
>>
>>and 3, isn't it so?
>>
>>I am
>> 
>>
>>
>>>using:
>>>   
>>>
>>
>>./check_nagios -V
>>check_nagios (nagios-plugins 1.4) 1.25
>>
>>The only
>> 
>>
>>
>>>hint I was able to find is the enum in the common.h.
>>>   
>>>
>>
>>I am not a programer,
>> 
>>
>>
>>>but if I understand the syntax of enum right it
>>>   
>>>
>>
>>should define exit codes
>> 
>>
>>
>>>integer from 0 +1...
>>>   
>>>
>>
>>Can someone tell me more about this?
>>
>>Best
>> 
>>
>>
>>>regards
>>>   
>>>
>>
>>Hendrik
>>
>> 
>>
>>
>>
>> 
>>
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> ::: Please include plugins version (-v) and OS when reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null
> 

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer




More information about the Help mailing list