Code

82dbecaaad44cede9aee25b6769d42ff7e205b90
[nagiosplug.git] / doc / developer-guidelines.sgml
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN" >
2 <book>
3   <title>Nagios Plug-in Developer Guidelines</title>
5   <bookinfo>
6     <authorgroup>
7       <author>
8         <affiliation>
9           <orgname>Nagios Plugins Development Team</orgname>
10         </affiliation>
11       </author>
12     </authorgroup>
14     <pubdate>2005</pubdate>
15     <title>Nagios plug-in development guidelines</title>
16         
17     <revhistory>
18        <revision>
19           <revnumber>$Revision$</revnumber>
20           <date>$Date$</date>
21        </revision>
22     </revhistory>
24         <copyright>
25                 <year>2000 - 2005</year> 
26                 <holder>Nagios Plugins Development Team</holder>
27         </copyright>
29 </bookinfo>
32 <preface id="preface"><title>Preface</title>
33     <para>The purpose of this guidelines is to provide a reference for
34     the plug-in developers and encourage the standarization of the
35     different kind of plug-ins: C, shell, perl, python, etc.</para>
37         <para>Nagios Plug-in Development Guidelines Copyright (C) 2000-2005
38         (Nagios Plugins Team)</para>
40         <para>Permission is granted to make and distribute verbatim
41         copies of this manual provided the copyright notice and this
42         permission notice are preserved on all copies.</para>
44         <para>The plugins themselves are copyrighted by their respective
45         authors.</para>
46 </preface>
48 <article>
49 <section id="DevRequirements"><title>Development platform requirements</title>
50         <para>
51         Nagios plugins are developed to the GNU standard, so any OS which is supported by GNU
52         should run the plugins. While the requirements for compiling the Nagios plugins release 
53         is very small, to develop from CVS needs additional software to be installed. These are the 
54         minimum levels of software required:
56         <literallayout>
57         gnu make 3.79
58         automake 1.8
59         autoconf 2.58
60         gettext 0.11.5
61         </literallayout>
63         To compile from CVS, after you have checked out the code, run:
64         <literallayout>
65         tools/setup
66         ./configure
67         make
68         make install
69         </literallayout>
70         </para>
71 </section>
73 <section id="PlugOutput"><title>Plugin Output for Nagios</title>
74         
75                 <para>You should always print something to STDOUT that tells if the 
76                 service is working or why it is failing. Try to keep the output short - 
77                 probably less that 80 characters. Remember that you ideally would like 
78                 the entire output to appear in a pager message, which will get chopped
79                 off after a certain length.</para>
81                 <section><title>Print only one line of text</title>
82                 <para>Nagios will only grab the first line of text from STDOUT
83                 when it notifies contacts about potential problems. If you print
84                 multiple lines, you're out of luck. Remember, keep it short and
85                 to the point.</para>
87                 <para>Output should be in the format:</para>
88                 <literallayout>
89                 SERVICE STATUS: Information text
90                 </literallayout>
91                 <para>However, note that this is not a requirement of the API, so you cannot depend on this
92                 being an accurate reflection of the status of the service - the status should always 
93                 be determined by the return code.</para>
94                 </section>
96                 <section><title>Verbose output</title>
97                 <para>Use the -v flag for verbose output. You should allow multiple
98                 -v options for additional verbosity, up to a maximum of 3. The standard
99                 type of output should be:</para>
101                 <table id="verboselevels"><title>Verbose output levels</title>
102                         <tgroup cols="2">
103                                 <thead>
104                                         <row>
105                                                 <entry><para>Verbosity level</para></entry>
106                                                 <entry><para>Type of output</para></entry>
107                                         </row>
108                                 </thead>
109                                 <tbody>
110                                         <row>
111                                                 <entry align="center"><para>0</para></entry>
112                                                 <entry><para>Single line, minimal output. Summary</para></entry>
113                                         </row>
114                                         <row>
115                                                 <entry align="center"><para>1</para></entry>
116                                                 <entry><para>Single line, additional information (eg list processes that fail)</para></entry>
117                                         </row>
118                                         <row>
119                                                 <entry align="center"><para>2</para></entry>
120                                                 <entry><para>Multi line, configuration debug output (eg ps command used)</para></entry>
121                                         </row>
122                                         <row>
123                                                 <entry align="center"><para>3</para></entry>
124                                                 <entry><para>Lots of detail for plugin problem diagnosis</para></entry>
125                                         </row>
126                                 </tbody>
127                         </tgroup>
128                 </table>
129                 </section>
131                 <section><title>Screen Output</title>
132                 <para>The plug-in should print the diagnostic and just the
133                 synopsis part of the help message.  A well written plugin would
134                 then have --help as a way to get the verbose help.</para>
135                 <para>Code and output should try to respect the 80x25 size of a
136                 crt (remember when fixing stuff in the server room!)</para>
137                 </section>
138                 
139                 <section><title>Plugin Return Codes</title>
140                 <para>The return codes below are based on the POSIX spec of returning
141                 a positive value.  Netsaint prior to v0.0.7 supported non-POSIX
142                 compliant return code of "-1" for unknown.  Nagios supports POSIX return
143                 codes by default.</para>
145                 <para>Note: Some plugins will on occasion print on STDOUT that an error
146                 occurred and error code is 138 or 255 or some such number.  These
147                 are usually caused by plugins using system commands and having not 
148                 enough checks to catch unexpected output.  Developers should include a
149                 default catch-all for system command output that returns an UNKNOWN
150                 return code.</para>
151                 
152                 <table id="ReturnCodes"><title>Plugin Return Codes</title>
153                         <tgroup cols="3">
154                                 <thead>
155                                         <row>
156                                                 <entry><para>Numeric Value</para></entry>
157                                                 <entry><para>Service Status</para></entry>
158                                                 <entry><para>Status Description</para></entry>
159                                         </row>
160                                 </thead>
161                                 <tbody>
162                                         <row>
163                                                 <entry align="center"><para>0</para></entry>
164                                                 <entry valign="middle"><para>OK</para></entry>
165                                                 <entry><para>The plugin was able to check the service and it 
166                                                 appeared to be functioning properly</para></entry>
167                                         </row>
168                                         <row>
169                                                 <entry align="center"><para>1</para></entry>
170                                                 <entry valign="middle"><para>Warning</para></entry>
171                                                 <entry><para>The plugin was able to check the service, but it 
172                                                 appeared to be above some "warning" threshold or did not appear 
173                                                 to be working properly</para></entry>
174                                         </row>
175                                         <row>
176                                                 <entry align="center"><para>2</para></entry>
177                                                 <entry valign="middle"><para>Critical</para></entry>
178                                                 <entry><para>The plugin detected that either the service was not 
179                                                 running or it was above some "critical" threshold</para></entry>
180                                         </row>
181                                         <row>
182                                                 <entry align="center"><para>3</para></entry>
183                                                 <entry valign="middle"><para>Unknown</para></entry>
184                                                 <entry><para>Invalid command line arguments were supplied to the 
185                                                 plugin or low-level failures internal to the plugin (such as unable to fork,
186                                                 or open a tcp socket) that prevent it from performing the specified
187                                                 operation. Higher-level errors (such as name resolution errors,
188                                                 socket timeouts, etc) are outside of the control of plugins and should
189                                                 generally NOT be reported as UNKNOWN states.
190                                                 </para></entry>
191                                         </row>
192                                 </tbody>
193                         </tgroup>
194                 </table>
196       
197                 </section>
199                 <section id="thresholdformat"><title>Threshold and ranges</title>
200                 <para>A range is defined as a start and end point (inclusive) on a numeric scale (possibly
201                 negative or positive infinity).
202                 </para>
203                 <para>A threshold is a range with an alert level (either warning or critical). Use the
204                 set_thresholds(thresholds *, char *, char *) function to set the thresholds.
205                 </para>
206                 <para>The theory is that the plugin will do some sort of check which returns
207                 back a numerical value, or metric, which is then compared to the warning and 
208                 critical thresholds. Use the get_status(double, thresholds *) function to
209                 compare the value against the thresholds.</para>
210                 <para>This is the generalised format for ranges:</para>
212                 <literallayout>
213                 [@]start:end
214                 </literallayout>
215         
216                 <para>Notes:</para>
217                 <orderedlist>
218                 <listitem><para>start &le; end</para>
219                         </listitem>
220                 <listitem><para>start and ":" is not required if start=0</para>
221                         </listitem>
222                 <listitem><para>if range is of format "start:" and end is not specified, 
223                         assume end is infinity</para>
224                         </listitem>
225                 <listitem><para>to specify negative infinity, use "~"</para>
226                         </listitem>
227                 <listitem><para>alert is raised if metric is outside start and end range
228                         (inclusive of endpoints)</para>
229                         </listitem>
230                 <listitem><para>if range starts with "@", then alert if inside this range
231                         (inclusive of endpoints)</para>
232                         </listitem>
233                 </orderedlist>
234                 
235                 <para>Note: Not all plugins are coded to expect ranges in this format yet.
236                 There will be some work in providing multiple metrics.</para>
237                 </section>
239                 <section><title>Performance data</title>
240                 <para>Performance data is defined by Nagios as "everything after the | of the plugin output" -
241                 please refer to Nagios documentation for information on capturing this data to logfiles.
242                 However, it is the responsibility of the plugin writer to ensure the 
243                 performance data is in a "Nagios plugins" format.
244                 This is the expected format:</para>
246                 <literallayout>
247                 'label'=value[UOM];[warn];[crit];[min];[max]
248                 </literallayout>
250                 <para>Notes:</para>
251                 <orderedlist>
252                 <listitem><para>space separated list of label/value pairs</para>
253                         </listitem>
254                 <listitem><para>label can contain any characters</para>
255                         </listitem>
256                 <listitem><para>the single quotes for the label are optional. Required if 
257                         spaces, = or ' are in the label</para>
258                         </listitem>
259                 <listitem><para>label length is arbitrary, but ideally the first 19 characters
260                         are unique (due to a limitation in RRD). Be aware of a limitation in the
261                         amount of data that NRPE returns to Nagios</para>
262                         </listitem>
263                 <listitem><para>to specify a quote character, use two single quotes</para>
264                         </listitem>
265                 <listitem><para>warn, crit, min or max may be null (for example, if the threshold is 
266                         not defined or min and max do not apply). Trailing unfilled semicolons can be
267                         dropped</para>
268                         </listitem>
269                 <listitem><para>min and max are not required if UOM=%</para>
270                         </listitem>
271                 <listitem><para>value, min and max in class [-0-9.]. Must all be the
272                         same UOM</para>
273                         </listitem>
274                 <listitem><para>warn and crit are in the range format (see 
275                         <xref linkend="thresholdformat">). Must be the same UOM</para>
276                         </listitem>
277                 <listitem><para>UOM (unit of measurement) is one of:</para>
278                         <orderedlist>
279                         <listitem><para>no unit specified - assume a number (int or float) 
280                                 of things (eg, users, processes, load averages)</para>
281                                 </listitem>
282                         <listitem><para>s - seconds (also us, ms)</para></listitem>
283                         <listitem><para>% - percentage</para></listitem>
284                         <listitem><para>B - bytes (also KB, MB, TB)</para></listitem>
285                         <listitem><para>c - a continous counter (such as bytes
286                                 transmitted on an interface)</para></listitem>
287                         </orderedlist>
288                         </listitem>
289                 </orderedlist>
291                 <para>It is up to third party programs to convert the Nagios plugins 
292                 performance data into graphs.</para>
293                 </section>
295         <section><title>Translations</title>
296         <para>If possible, use translation tools for all output to respect the user's language 
297                 settings. See <xref linkend="translations_developers"> for guidelines 
298                 for the core plugins. 
299         </para>
300         </section>
301 </section>
303 <section id="SysCmdAuxFiles"><title>System Commands and Auxiliary Files</title>
305                 <section><title>Don't execute system commands without specifying their
306                 full path</title>
307                 <para>Don't use exec(), popen(), etc. to execute external
308                 commands without explicity using the full path of the external
309                 program.</para>
311                 <para>Doing otherwise makes the plugin vulnerable to hijacking
312                 by a trojan horse earlier in the search path. See the main
313                 plugin distribution for examples on how this is done.</para>
314                 </section>
316                 <section><title>Use spopen() if external commands must be executed</title>
318             <para>If you have to execute external commands from within your
319         plugin and you're writing it in C, use the spopen() function
320                 that Karl DeBisschop has written.</para>
322                 <para>The code for spopen() and spclose() is included with the
323                 core plugin distribution.</para>
324                 </section>
326                 <section><title>Don't make temp files unless absolutely required</title>
328                 <para>If temp files are needed, make sure that the plugin will
329                 fail cleanly if the file can't be written (e.g., too few file
330                 handles, out of disk space, incorrect permissions, etc.) and
331                 delete the temp file when processing is complete.</para>
332                 </section>
334         <section><title>Don't be tricked into following symlinks</title>
336                 <para>If your plugin opens any files, take steps to ensure that
337                 you are not following a symlink to another location on the
338                 system.</para>
339                 </section>
341                 <section><title>Validate all input</title>
343                 <para>use routines in utils.c or utils.pm and write more as needed</para>
344                 </section>
346 </section>
347         
351 <section id="PerlPlugin"><title>Perl Plugins</title>
353                 <para>Perl plugins are coded a little more defensively than other
354                 plugins because of embedded Perl.  When configured as such, embedded
355                 Perl Nagios (ePN) requires stricter use of the some of Perl's features.
356                 This section outlines some of the steps needed to use ePN
357                 effectively.</para>
358           
359                 <orderedlist>
360                         
361                         <listitem><para> Do not use BEGIN and END blocks since they will be called 
362                         only once (when Nagios starts and shuts down) with Embedded Perl (ePN).  In 
363                         particular, do not use BEGIN blocks to initialize variables.</para>
364                         </listitem>
365           
366                         <listitem><para>To use utils.pm, you need to provide a full path to the
367                         module in order for it to work.</para>
368                         
369           <literallayout>
370           e.g.
371                 use lib "/usr/local/nagios/libexec";
372                 use utils qw(...);
373           </literallayout>
374                         </listitem>
376                         <listitem><para>Perl scripts should be called with "-w"</para>
377                         </listitem>
378                         
379                         <listitem><para>All Perl plugins must compile cleanly under "use strict" - i.e. at
380                         least explicitly package names as in "$main::x" or predeclare every
381                         variable. </para>
382                         
384                         <para>Explicitly initialize each variable in use.  Otherwise with
385                         caching enabled, the plugin will not be recompiled each time, and
386                         therefore Perl will not reinitialize all the variables.  All old
387                         variable values will still be in effect.</para>
388                         </listitem>
389                         
390                         <listitem><para>Do not use &gt;DATA&lt; handles (these simply do not compile under ePN).</para>
391                         </listitem>
393                         <listitem><para>Do not use global variables in named subroutines. This is bad practise anyway, but with ePN the
394                         compiler will report an error "&lt;global_var&gt; will not stay shared ..". Values used by
395                         subroutines should be passed in the argument list.</para> 
396                         </listitem>
398                         <listitem><para>If writing to a file (perhaps recording
399                         performance data) explicitly close close it.  The plugin never
400                         calls <emphasis role="strong">exit</emphasis>; that is caught by
401                         p1.pl, so output streams are never closed.</para>
402                         </listitem>
403                 
404                         <listitem><para>As in <xref linkend="runtime"> all plugins need 
405                         to monitor their runtime, specially if they are using network
406                         resources.  Use of the <emphasis>alarm</emphasis> is recommended
407                         noting that some Perl modules (eg LWP) manage timers, so that an alarm
408                         set by a plugin using such a module is overwritten by the module.
409                         (workarounds are cunning (TM) or using the module timer)
410                         Plugins may import a default time out ($TIMEOUT) from utils.pm.
411                         </para>
412                         </listitem>
414                         <listitem><para>Perl plugins should import %ERRORS from utils.pm
415                         and then "exit $ERRORS{'OK'}" rather than "exit 0"
416                         </para>
417                         </listitem>
418                         
419                 </orderedlist>
420           
421 </section>
423 <section id="runtime"><title>Runtime Timeouts</title>
425                 <para>Plugins have a very limited runtime - typically 10 sec.
426                 As a result, it is very important for plugins to maintain internal
427                 code to exit if runtime exceeds a threshold. </para>
429                 <para>All plugins should timeout gracefully, not just networking
430                 plugins. For instance, df may lock if you have automounted
431                 drives and your network fails - but on first glance, who'd think
432                 df could lock up like that.  Plus, it should just be more error
433                 resistant to be able to time out rather than consume
434                 resources.</para>
435                 
436                 <section><title>Use DEFAULT_SOCKET_TIMEOUT</title>
438                 <para>All network plugins should use DEFAULT_SOCKET_TIMEOUT to timeout</para>
440                 </section>
442                 
443                 <section><title>Add alarms to network plugins</title>
445                 <para>If you write a plugin which communicates with another
446                 networked host, you should make sure to set an alarm() in your
447                 code that prevents the plugin from hanging due to abnormal
448                 socket closures, etc. Nagios takes steps to protect itself
449                 against unruly plugins that timeout, but any plugins you create
450                 should be well behaved on their own.</para>
452                 </section>
454                 
456 </section>
458 <section id="PlugOptions"><title>Plugin Options</title>
459         
460                 <para>A well written plugin should have --help as a way to get 
461                 verbose help. Code and output should try to respect the 80x25 size of a
462                 crt (remember when fixing stuff in the server room!)</para>
463                 
464                 <section><title>Option Processing</title>
466                 <para>For plugins written in C, we recommend the C standard
467                 getopt library for short options. Getopt_long is always available.
468                 </para>
470                 <para>For plugins written in Perl, we recommend Getopt::Long module.</para>
472                 <para>Positional arguments are strongly discouraged.</para>
474                 <para>There are a few reserved options that should not be used
475                 for other purposes:</para>
477                 <literallayout>
478           -V version (--version)
479           -h help (--help)
480           -t timeout (--timeout)
481           -w warning threshold (--warning)
482           -c critical threshold (--critical)
483           -H hostname (--hostname)
484           -v verbose (--verbose)
485                 </literallayout>
487                 <para>In addition to the reserved options above, some other standard options are:</para>
489                 <literallayout>
490           -C SNMP community (--community)
491           -a authentication password (--authentication)
492           -l login name (--logname)
493           -p port or password (--port or --passwd/--password)monitors operational
494           -u url or username (--url or --username)
495                 </literallayout>
496           
497                 <para>Look at check_pgsql and check_procs to see how I currently
498                 think this can work.  Standard options are:</para>
500           
501                 <para>The option -V or --version should be present in all
502                 plugins. For C plugins it should result in a call to print_revision, a
503                 function in utils.c which takes two character arguments, the
504                 command name and the plugin revision.</para>
506                 <para>The -? option, or any other unparsable set of options,
507                 should print out a short usage statement. Character width should
508                 be 80 and less and no more that 23 lines should be printed (it
509                 should display cleanly on a dumb terminal in a server
510                 room).</para>
512                 <para>The option -h or --help should be present in all plugins.
513                 In C plugins, it should result in a call to print_help (or
514                 equivalent).  The function print_help should call print_revision, 
515                 then print_usage, then should provide detailed
516                 help. Help text should fit on an 80-character width display, but
517                 may run as many lines as needed.</para>
519                 <para>The option -v or --verbose should be present in all plugins.
520                 The user should be allowed to specify -v multiple times to increase
521                 the verbosity level, as described in <xref linkend="verboselevels">.</para>
522     </section>
524     <section>
525       <title>Plugins with more than one type of threshold, or with
526       threshold ranges</title>
528       <para>Old style was to do things like -ct for critical time and
529       -cv for critical value. That goes out the window with POSIX
530       getopt. The allowable alternatives are:</para>
532       <orderedlist>
533         <listitem>
534           <para>long options like -critical-time (or -ct and -cv, I
535           suppose).</para>
536         </listitem>
538         <listitem>
539           <para>repeated options like `check_load -w 10 -w 6 -w 4 -c
540           16 -c 10 -c 10`</para>
541         </listitem>
543         <listitem>
544           <para>for brevity, the above can be expressed as `check_load
545           -w 10,6,4 -c 16,10,10`</para>
546         </listitem>
548         <listitem>
549           <para>ranges are expressed with colons as in `check_procs -C
550           httpd -w 1:20 -c 1:30` which will warn above 20 instances,
551           and critical at 0 and above 30</para>
552         </listitem>
554         <listitem>
555           <para>lists are expressed with commas, so Jacob's check_nmap
556           uses constructs like '-p 1000,1010,1050:1060,2000'</para>
557         </listitem>
559         <listitem>
560           <para>If possible when writing lists, use tokens to make the
561           list easy to remember and non-order dependent - so
562           check_disk uses '-c 10000,10%' so that it is clear which is
563           the precentage and which is the KB values (note that due to
564           my own lack of foresight, that used to be '-c 10000:10%' but
565           such constructs should all be changed for consistency,
566           though providing reverse compatibility is fairly
567           easy).</para>
568         </listitem>
570       </orderedlist>
572       <para>As always, comments are welcome - making this consistent
573       without a host of long options was quite a hassle, and I would
574       suspect that there are flaws in this strategy. 
575       </para>
576     </section>
577 </section>
579 <section id="Testcases"><title>Test cases</title>
580 <para>
581 Tests are the best way of knowing if the plugins work as expected. Please
582 create and update test cases where possible.
583 </para>
585 <para>
586 To run a test, from the top level directory, run "make test". This will run 
587 all the current tests and report an overall success rate.
588 </para>
590 <para>
591 See the <ulink url="http://tinderbox.altinity.org">Nagios Plugins Tinderbox server</ulink>
592 for the daily test results.
593 </para>
595 <section><title>Test cases for plugins</title>
596 <para>These use perl's Test::More. To do a one time test, run "cd plugins && perl t/check_disk.t".
597 </para>
599 <para>There will somtimes be failures seen in this output which are known failures that
600 need to be fixed. As long as the return code is 0, it will be reported as "test pass".
601 (If you have a fix so that the specific test passes, that will be gratefully received!)
602 </para>
604 <para>
605 If you want a summary test, run: "cd plugins && prove t/check_disk.t".
606 This runs the test in a summary format.
607 </para>
609 <para>
610 For a good and amusing tutorial on using Test::More, see this 
611 <ulink url="http://search.cpan.org/~mschwern/Test-Simple-0.62/lib/Test/Tutorial.pod">
612 link</ulink>
613 </para>
615 </section>
617 <section><title>Testing the C library functions</title>
618 <para>
619 Uses <ulink url="http://jc.ngo.org.uk/trac-bin/trac.cgi/wiki/LibTap">the libtap library</ulink>, which gives 
620 perl's TAP
621 (Test Anything Protocol) output. This is used by the FreeBSD team for their regression testing.
622 </para>
624 <para>
625 To run tests using the libtap library, download from http://people.freebsd.org/~nik/public_distfiles/
626 and compile. There is a problem with tap-1.01 
627 where <ulink url="http://jc.ngo.org.uk/trac-bin/trac.cgi/ticket/25">pthread support doesn't appear to work</ulink>
628 properly on non-FreeBSD systems. Compile with 'CPPFLAGS="-UHAVE_LIBPTHREAD" ./configure'. You do not need 
629 to install.
630 </para>
632 <para>
633 You then have to run the Nagios Plugins' configure with the --with-libtap-object=full_path to the compiled 
634 tap.o file.
635 Then run "make" and "make test" to run all tests.
636 </para>
637 </section>
639 </section>
640 <section id="CodingGuidelines"><title>Coding guidelines</title>
641         <para>See <ulink url="http://www.gnu.org/prep/standards_toc.html">GNU
642         Coding standards</ulink> for general guidelines.</para>
643         <section><title>Comments</title>
644         <para>You should use /* */ for comments and not // as some compilers
645         do not handle the latter form.</para>
646         <para>If you have copied a routine from another source, make sure the licence
647         from your source allows this. Add a comment referencing the ACKNOWLEDGEMENTS
648         file, where you can put more detail about the source.</para>
649         <para>For contributed code, do not add any named credits in the source code 
650         - contributors should be added into the THANKS.in file instead. 
651         </para>
652         </section>
654         <section><title>CVS comments</title>
655         <para>When adding CVS comments at commit time, you can use the following prefixes:
656         <variablelist>
657           <varlistentry><term>- comment</term>
658           <listitem>
659             <para>for a comment that can be removed from the Changelog</para>
660           </listitem>
661           </varlistentry>
662           <varlistentry><term>* comment</term>
663           <listitem>
664             <para>for an important amendment to be included into a features list</para>
665           </listitem>
666           </varlistentry>
667         </variablelist>
668         </para>
669         <para>If the change is due to a contribution, please quote the contributor's name 
670         and, if applicable, add the SourceForge Tracker number. Don't forget to 
671 update the THANKS.in file.</para>
672         </section>
674         <section id="translations_developers"><title>Translations for developers</title>
675         <para>To make the job easier for translators, please follow these guidelines:</para>
676         <orderedlist>
677           <listitem><para>
678             Before creating new strings, check the po/nagios-plugins.pot file to 
679             see if a similar string
680             already exists
681           </para></listitem>
682           <listitem><para>
683             For help texts, break into individual options so that these can be reused
684             between plugins
685           </para></listitem>
686           <listitem><para>Try to avoid linefeeds unless you are working on a block of text</para></listitem>
687           <listitem><para>Short help is not translated</para></listitem>
688           <listitem><para>Long help has options in English language, but text translated</para></listitem>
689           <listitem><para>"Copyright" kept in English</para></listitem>
690           <listitem><para>Copyright holder names kept in original text</para></listitem>
691           <listitem><para>Debugging output does not need to be translated</para></listitem>
692         </orderedlist>
693         </section>
695         <section><title>Translations for translators</title>
696         <para>To create an up to date list of translatable strings, run: tools/gen_locale.sh</para>
697         </section>
699 </section>
701 <section id="SubmittingChanges"><title>Submission of new plugins and patches</title>
703         <section id="Patches"><title>Patches</title>
704         <para>If you have a bug patch, please supply a unified or context diff against the
705         version you are using. For new features, please supply a diff against
706         the CVS HEAD version.</para>
708         <para>Patches should be submitted via 
709         <ulink url="http://sourceforge.net/tracker/?group_id=29880&amp;atid=397599">SourceForge's
710         tracker system for Nagiosplug patches</ulink> 
711         and be announced to the nagiosplug-devel mailing list.</para>
713         <para>Submission of a patch implies that the submmitter acknowledges that they
714         are the author of the code (or have permission from the author to release the code)
715         and agree that the code can be released under the GPL. The copyright for the changes will 
716         then revert to the Nagios Plugin Development Team - this is required so that any copyright 
717         infringements can be investigated quickly without contacting a huge list of copyright holders.
718         Credit will always be given for any patches through a THANKS file in the distribution.</para>
719         </section>
721         <section id="Newplugins"><title>New plugins</title>
723         <para>If you would like others to use your plugins, please add it to
724         the official 3rd party plugin repository, 
725         <ulink url="http://www.nagiosexchange.org">NagiosExchange</ulink>.
726         </para>
728         <para>We are not accepting requests for inclusion of plugins into 
729         our distribution at the moment, but when we do, these are the minimum
730         requirements:
731         </para>
733       <orderedlist>
734         <listitem>
735           <para>Include copyright and license information in all files</para>
736         </listitem>
737         <listitem>
738           <para>The standard command options are supported (--help, --version,
739           --timeout, --warning, --critical)</para>
740         </listitem>
741         <listitem>
742           <para>It is determined to be not redundant (for instance, we would not 
743                 add a new version of check_disk just because someone had provide 
744                 a plugin that had perf checking - we would incorporate the features 
745                 into an exisiting plugin)</para>
746         </listitem>
747         <listitem>
748           <para>One of the developers has had the time to audit the code and declare
749                 it ready for core</para>
750         </listitem>
751         <listitem>
752           <para>It should also follow code format guidelines, and use functions from
753 utils (perl or c or sh) rather than using its own</para>
754         </listitem>
755         <listitem>
756           <para>Includes patches to configure.in if required (via the EXTRAS list if 
757           it will only work on some platforms)</para>
758         </listitem>
759         <listitem>
760           <para>If possible, please submit a test harness. Documentation on sample
761           tests coming soon</para>
762         </listitem>
763       </orderedlist>
765         </section>
767 </section>
768 </article>
769   
770 </book>