Code

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