http://qs1969.pair.com?node_id=225861

vroom has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I'd like to write some custom Perl nagios plugins for monitoring some of the systems I'm responsible for. Basically most of them boil down to sending an LWP request to a webserver and making sure that the response that comes back is what is expected.
I've been directed to http://nagiosplug.sourceforge.net/developer-guidelines.html for some help but was wondering if anyone had any experience writing Nagios plugins. What are the basic things that are required for a Perl plugin to work correctly? Are there any gotchas I should look out for? Any insight or examples would be most helpful.

Thanks in advance,
--vroom

Replies are listed 'Best First'.
Re: Help writing custom Perl nagios plugins
by dug (Chaplain) on Jan 10, 2003 at 20:45 UTC
Re: Help writing custom Perl nagios plugins
by waswas-fng (Curate) on Jan 10, 2003 at 20:28 UTC
    That doc describes all of the caveats for writing ePN plugins, the big ones being no named subs, no BEGIN/END blocks and close your files (as exit is never called). The output generated should be pretty short and readable even with a few chars fubarded on a alpha page. and the exit status codes (even though the table in the doco says the numerics) should be pulled out of util.pm (%ERRORS).

    -Waswas
Re: Help writing custom Perl nagios plugins
by Notromda (Pilgrim) on Jan 10, 2003 at 19:35 UTC
    Ironic that one of my employees just brought the nagios project to my attention. So ++ to anyone who can shed more light on this. :)
      i wrote a nagios plugin that validates the xml of a site. the most important thing is the return codes. Nagios expects one of 4 exit codes: exit code status description 0 OK all good 1 warning working, but needs attention 2 critical not working correctly 3 unknown plugin could not determine the state install the plugin in /usr/lib/nagios/plugins make is executable create the check.. thats it..