[Nagiosplug-devel] Nagios::Plugin api
Gavin Carr
gavin at openfusion.com.au
Thu Sep 7 04:09:29 CEST 2006
On Tue, Sep 05, 2006 at 10:10:23AM -0800, Vonnahme, Nathan wrote:
> Good point about new users, John, although I hope they will read the POD
> for examples before googling.
>
> Shall we just leave it as
> $plugin->nagios_die(CRITICAL, "aiiiii") if $bad;
> $plugin->nagios_exit(); # OK
>
> ?
I'm thinking we just go with
$plugin->nagios_exit( CRITICAL, "aiiii" ) if $bad;
$plugin->nagios_exit( OK, "foobar" );
on the basis that:
- CORE::exit() takes a return value, so our nagios_exit is a pretty
intuitive extension of that (where CORE::die() takes a message and
no return value)
- the order of arguments ( code => message ) mirrors the order you
get in the Status Information within nagios itself. Not that
significant, but maybe helpful for newbies.
We can always add nagios_die as well later if people feel strongly
about it.
For backwards compatibility, we should also support these two:
$plugin->nagios_exit( return_code => OK, message => $msg );
$plugin->die( return_code => OK, message => $msg );
That sound reasonable? Barring objections, I'll probably take a look at
implementing this in the next few days.
I'm going to restart the thresholds api discussion in a separate thread
for clarity.
Cheers,
Gavin
More information about the Devel
mailing list