Nagios plugin guidelines.
Stanley Hopcroft
Stanley.Hopcroft at IPAustralia.Gov.AU
Wed Feb 4 06:28:40 CET 2004
On Tue, Feb 03, 2004 at 08:20:45PM -0800, nagios-users-request at lists.sourceforge.net wrote:
Dear Sir,
I am writing to thank you for your letter and say,
> From: "Yohann DESQUERRE (DSI NOISIEL)" <yohann.desquerre at anpe.fr>
> To: <nagios-users at lists.sourceforge.net>
> Subject: [Nagios-users] How to develop personal plugins to work with nagios ???
>
> Hi all,
>
> We'd like to monitor via Nagios products which haven't got existants
> pluggins!!!
>
> Our duty is to develop the pluggins we need (the needs are very
> specific)!!!!
>
>
> Are there any existants best practices on how to develop pluggins for
> Nagios????
http://nagiosplug.sourceforge.net/developer-guidelines.html
Not quite what you asked for but close.
In a nutshell,
1 foo yad blech - check business/service is kaput
2 write an appropriate message (that will be sent to the contact group)
3 exit with the corresponding Nagios exit code
Do's and Don'ts for publication/portability/maintenance/best practises
1 use the same 'style' as the other plugins
2 use the plugin infrastructure (eg import utils.pm for Perl plugins)
3 use a language that is readily available and familiar (eschew LISP
for example, if all you want is list data structures): C /bin/sh Perl
Python Ruby are reasonable choices.
4 use the standard options - see the option plugin
5 provide a help/usage message
6 be mindful of language specific issues (eg Perl with the embedded
interpreter)
7 provide some tests - use the Perl Test.pm and Test::Harness for
example.
8 handle timeouts. Don't let your plugin run forever (hint:
alarm($TIMEOUT))
9 if your module is Perl or Python ..., trap 'use Required_Module'
statements where the module is not installed and exit with an UNKNOWN
status and the usage message.
The real meta advice is simply the same for any coding exercise. Read
code; Read code; Read code; until you know what works for you and what
works for others and what is the subset of the intersection that you
like.
For example, gawk at the amazing plugins already in the CVS.
>
>
> Thanks for help
>
>
> -----------------------------------------------
> Yohann Desquerre
> "Plateforme ANPE.FR"
> S/Direction de la production
> Gestion des Ressources
> -----------------------------------------------
Yours sincerely.
--
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------
'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'
from Meditation 17, J Donne.
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
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