FW: Nagios behaviour problem

nagios at mm.quex.org nagios at mm.quex.org
Wed Mar 30 03:11:49 CEST 2005


On Tue, Mar 29, 2005 at 02:47:55PM -0800, Ed Smith wrote:

> I have it setup to return 0, 1, and 2 for OK, Warn, and critical resp.
> and I have verified that it works.  However, I stil get no output. 

> 
> -={nagios at thumper}=- pts -={14:41/29-Mar-05}=-
> -={$:/opt/nagios}=-/opt/nagios/disk_check.pl 50 60
> WARNING - Filesystem /dev/sda5 has capacity 56%
> WARNING - Filesystem /dev/sda8 has capacity 53%
> 1
> 
> -={nagios at thumper}=- pts -={14:41/29-Mar-05}=-
> 
> The above output is from the nagios user running the script.  I have
> my exit status set to return the same number printed at the end.

You've misunderstood how the plugins work.

The return value (0, 1, 2) is not meant to be printed to stdout,
but instead returned as the 'exit code' of the program or script.
In PERL, you can use 'exit 1;' to return such a code.  For testing,
you can use (under a bourne-type shell) use "echo $?" to check the
return value of the previous command:

$ perl -e 'exit 5;'
$ echo $?
5

Also, Nagios will only use the first line of a plugin's output,
so you'll need to work out how to refactor the status into a
single line of output.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at 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





More information about the Users mailing list