becoming a plugin developer

Thomas Sluyter nagios at kilala.nl
Wed Oct 25 17:28:08 CEST 2006


On 25 Oct, 2006, at 14:51, Alexander Harvey wrote:

>> Judging by what you said, you're already one :) Feel free to share
>> all your plugins on the Exchange, so all Nagios users can benefit
>> from them. That's all there is to it :)
>
> Well I suppose in that sense I am a plugin developer but I was really
> considering such things as: guidelines for interfacing with the  
> Nagios host
Ah! I was thinking one step too far :)

While I was writing this reply I was called away for a few hours and  
in the meantime Aaron linked to the official guidelines. That's  
always a good place to start reading :)

In that case:
> (i.e. standard plugin syntax?) How much output text is appropriate,
We usually restrict ourselves to one line, through STDOUT. And a  
plugin should indeed limit itself to a certain number of exit codes  
(0=ok, 1=warn, 2=crit, 3=unknown). The exit code stuff can also be  
derived from utils.sh and utils.pm in $NAGIOS_LIBEXEC. See the  
guidelines.

> performance considerations,
I'm sure there are loads of'em :) Just try to keep the runtime of  
your plugin as short as possible. Naturally, also try to limit the  
amount of resources you claim on the client. Monitoring shouldn't be  
intrusive :)

> style considerations,
When it comes to coding style, choose what feels natural to you.
When it comes to code layout, please keep things as clean as  
possible. I don't believe there's one standard for the contributed  
Nagios plugins though. Search the web for a few examples and try to  
stick to them. This should help keep your source clean and readable.

> documentation,
In general it is well appreciated if you include a semi-lengthy  
description of your plugin at the top of the source. Describe its  
function, and its behaviour depending on various situation. Describe  
input and output. Describe on which platforms (OS. Nagios. Versions)  
your plugin has been tested and proven to work. Also include a short  
comment at crucial points in the code.

Basic programming "best practices", really.

> versioning, revision control,
AFAIK there is no standardised versioning scheme that was agreed upon  
for contributed Nagios plugins.

> licensing,
Most of us release our plugins under GPL license, or no license at  
all. Most of the stuff I write I don't deem worthy of any licensing,  
since it really isn't that complicated. I just see it as helping  
people out by saving them the time of writing the same script.

On the other hand, I _could_ start GPLing my plugins since it'll help  
in dick-waving contest :D (Lookit me! I have my name on a copyright!)...

> anything else before unleashing my plugin onto someone else's  
> production systems, etc.
I've got one word for you: testing. Testing. _TESTING_.

Okay, so that's one word, repeated thrice, but that's only to imprint  
on you that _testing_ is important. Try running your plugin through  
all its paces and all permutations of the environment it might  
encounter. This will help you to get rid of most bugs. You won't  
catch all of them, but you'll come a long way.

Also, for the more complicated plugins write a test script to help  
you automate the testing. That way you'll be able to reproduce the  
exact same testing routine every time. It'll also save you a lot of  
time :p And if people run into problems with your plugin, you could  
send them the script and ask for the returned output and/or logfile.

Speaking of... Build hooks into your more complex plugins for some  
sort of debugging mode. In said debugging mode the plugin will  
generate loads of status information so you can check exactly where  
things are going wrong.

> As far as becoming a core developer, I don't think I have the C  
> behind me
Me either :3

Cheers!


Thomas

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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