developer-guidelines.sgml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN" >
  2. <book>
  3. <title>Nagios Plug-in Developer Guidelines</title>
  4. <bookinfo>
  5. <authorgroup>
  6. <author>
  7. <firstname>Karl</firstname>
  8. <surname>DeBisschop</surname>
  9. <affiliation>
  10. <address><email>karl@debisschop.net</email></address>
  11. </affiliation>
  12. </author>
  13. <author>
  14. <firstname>Ethan</firstname>
  15. <surname>Galstad</surname>
  16. <authorblurb>
  17. <para>Author of Nagios</para>
  18. <para><ulink url="http://www.nagios.org"></ulink></para>
  19. </authorblurb>
  20. <affiliation>
  21. <address><email>netsaint@linuxbox.com</email></address>
  22. </affiliation>
  23. </author>
  24. <author>
  25. <firstname>Hugo</firstname>
  26. <surname>Gayosso</surname>
  27. <affiliation>
  28. <address><email>hgayosso@gnu.org</email></address>
  29. </affiliation>
  30. </author>
  31. <author>
  32. <firstname>Subhendu</firstname>
  33. <surname>Ghosh</surname>
  34. <affiliation>
  35. <address><email>sghosh@sourceforge.net</email></address>
  36. </affiliation>
  37. </author>
  38. <author>
  39. <firstname>Stanley</firstname>
  40. <surname>Hopcroft</surname>
  41. <affiliation>
  42. <address><email>stanleyhopcroft@sourceforge.net</email></address>
  43. </affiliation>
  44. </author>
  45. <author>
  46. <firstname>Ton</firstname>
  47. <surname>Voon</surname>
  48. <affiliation>
  49. <address><email>tonvoon@users.sourceforge.net</email></address>
  50. </affiliation>
  51. </author>
  52. <author>
  53. <firstname>Jeremy T</firstname>
  54. <surname>Bouse</surname>
  55. <affiliation>
  56. <address><email>undrgrid@users.sourceforge.net</email></address>
  57. </affiliation>
  58. </author>
  59. </authorgroup>
  60. <pubdate>2002</pubdate>
  61. <title>Nagios plug-in development guidelines</title>
  62. <revhistory>
  63. <revision>
  64. <revnumber>$Revision$</revnumber>
  65. <date>$Date$</date>
  66. </revision>
  67. </revhistory>
  68. <copyright>
  69. <year>2000 - 2004</year>
  70. <holder>Nagios Plugins Development Team</holder>
  71. </copyright>
  72. </bookinfo>
  73. <preface id="preface"><title>Preface</title>
  74. <para>The purpose of this guidelines is to provide a reference for
  75. the plug-in developers and encourage the standarization of the
  76. different kind of plug-ins: C, shell, perl, python, etc.</para>
  77. <para>Nagios Plug-in Development Guidelines Copyright (C) 2000-2003
  78. (Karl DeBisschop, Ethan Galstad, Stanley Hopcroft, Subhendu Ghosh, Ton Voon, Jeremy T. Bouse)</para>
  79. <para>Permission is granted to make and distribute verbatim
  80. copies of this manual provided the copyright notice and this
  81. permission notice are preserved on all copies.</para>
  82. <para>The plugins themselves are copyrighted by their respective
  83. authors.</para>
  84. </preface>
  85. <article>
  86. <section id="DevRequirements"><title>Development platform requirements</title>
  87. <para>
  88. Nagios plugins are developed to the GNU standard, so any OS which is supported by GNU
  89. should run the plugins. While the requirements for compiling the Nagios plugins release
  90. is very small, to develop from CVS needs additional software to be installed. These are the
  91. minimum levels of software required:
  92. <literallayout>
  93. gnu make 3.79
  94. automake 1.6
  95. autoconf 2.54
  96. gettext 0.11.5
  97. </literallayout>
  98. To compile from CVS, after you have checked out the code, run:
  99. <literallayout>
  100. tools/setup
  101. ./configure
  102. make
  103. make install
  104. </literallayout>
  105. </para>
  106. </section>
  107. <section id="PlugOutput"><title>Plugin Output for Nagios</title>
  108. <para>You should always print something to STDOUT that tells if the
  109. service is working or why it is failing. Try to keep the output short -
  110. probably less that 80 characters. Remember that you ideally would like
  111. the entire output to appear in a pager message, which will get chopped
  112. off after a certain length.</para>
  113. <section><title>Print only one line of text</title>
  114. <para>Nagios will only grab the first line of text from STDOUT
  115. when it notifies contacts about potential problems. If you print
  116. multiple lines, you're out of luck. Remember, keep it short and
  117. to the point.</para>
  118. <para>Output should be in the format:</para>
  119. <literallayout>
  120. METRIC STATUS: Information text
  121. </literallayout>
  122. <para>However, note that this is not a requirement of the API, so you cannot depend on this
  123. being an accurate reflection of the status of the service - the status should always
  124. be determined by the return code.</para>
  125. </section>
  126. <section><title>Verbose output</title>
  127. <para>Use the -v flag for verbose output. You should allow multiple
  128. -v options for additional verbosity, up to a maximum of 3. The standard
  129. type of output should be:</para>
  130. <table id="verboselevels"><title>Verbose output levels</title>
  131. <tgroup cols="2">
  132. <thead>
  133. <row>
  134. <entry><para>Verbosity level</para></entry>
  135. <entry><para>Type of output</para></entry>
  136. </row>
  137. </thead>
  138. <tbody>
  139. <row>
  140. <entry align="center"><para>0</para></entry>
  141. <entry><para>Single line, minimal output. Summary</para></entry>
  142. </row>
  143. <row>
  144. <entry align="center"><para>1</para></entry>
  145. <entry><para>Single line, additional information (eg list processes that fail)</para></entry>
  146. </row>
  147. <row>
  148. <entry align="center"><para>2</para></entry>
  149. <entry><para>Multi line, configuration debug output (eg ps command used)</para></entry>
  150. </row>
  151. <row>
  152. <entry align="center"><para>3</para></entry>
  153. <entry><para>Lots of detail for plugin problem diagnosis</para></entry>
  154. </row>
  155. </tbody>
  156. </tgroup>
  157. </table>
  158. </section>
  159. <section><title>Screen Output</title>
  160. <para>The plug-in should print the diagnostic and just the
  161. synopsis part of the help message. A well written plugin would
  162. then have --help as a way to get the verbose help.</para>
  163. <para>Code and output should try to respect the 80x25 size of a
  164. crt (remember when fixing stuff in the server room!)</para>
  165. </section>
  166. <section><title>Return the proper status code</title>
  167. <para>See <xref linkend="ReturnCodes"> below
  168. for the numeric values of status codes and their
  169. description. Remember to return an UNKNOWN state if bogus or
  170. invalid command line arguments are supplied or it you are unable
  171. to check the service.</para>
  172. </section>
  173. <section><title>Plugin Return Codes</title>
  174. <para>The return codes below are based on the POSIX spec of returning
  175. a positive value. Netsaint prior to v0.0.7 supported non-POSIX
  176. compliant return code of "-1" for unknown. Nagios supports POSIX return
  177. codes by default.</para>
  178. <para>Note: Some plugins will on occasion print on STDOUT that an error
  179. occurred and error code is 138 or 255 or some such number. These
  180. are usually caused by plugins using system commands and having not
  181. enough checks to catch unexpected output. Developers should include a
  182. default catch-all for system command output that returns an UNKNOWN
  183. return code.</para>
  184. <table id="ReturnCodes"><title>Plugin Return Codes</title>
  185. <tgroup cols="3">
  186. <thead>
  187. <row>
  188. <entry><para>Numeric Value</para></entry>
  189. <entry><para>Service Status</para></entry>
  190. <entry><para>Status Description</para></entry>
  191. </row>
  192. </thead>
  193. <tbody>
  194. <row>
  195. <entry align="center"><para>0</para></entry>
  196. <entry valign="middle"><para>OK</para></entry>
  197. <entry><para>The plugin was able to check the service and it
  198. appeared to be functioning properly</para></entry>
  199. </row>
  200. <row>
  201. <entry align="center"><para>1</para></entry>
  202. <entry valign="middle"><para>Warning</para></entry>
  203. <entry><para>The plugin was able to check the service, but it
  204. appeared to be above some "warning" threshold or did not appear
  205. to be working properly</para></entry>
  206. </row>
  207. <row>
  208. <entry align="center"><para>2</para></entry>
  209. <entry valign="middle"><para>Critical</para></entry>
  210. <entry><para>The plugin detected that either the service was not
  211. running or it was above some "critical" threshold</para></entry>
  212. </row>
  213. <row>
  214. <entry align="center"><para>3</para></entry>
  215. <entry valign="middle"><para>Unknown</para></entry>
  216. <entry><para>Invalid command line arguments were supplied to the
  217. plugin or the plugin was unable to check the status of the given
  218. hosts/service</para></entry>
  219. </row>
  220. </tbody>
  221. </tgroup>
  222. </table>
  223. </section>
  224. <section id="thresholdformat"><title>Threshold range format</title>
  225. <para>Thresholds ranges define the warning and critical levels for plugins to
  226. alert on. The theory is that the plugin will do some sort of check which returns
  227. back a numerical value, or metric, which is then compared to the warning and
  228. critical thresholds.
  229. This is the generalised format for threshold ranges:</para>
  230. <literallayout>
  231. [@]start:end
  232. </literallayout>
  233. <para>Notes:</para>
  234. <orderedlist>
  235. <listitem><para>start &gt; end</para>
  236. </listitem>
  237. <listitem><para>start and ":" is not required if start=0</para>
  238. </listitem>
  239. <listitem><para>if range is of format "start:" and end is not specified,
  240. assume end is infinity</para>
  241. </listitem>
  242. <listitem><para>to specify negative infinity, use "~"</para>
  243. </listitem>
  244. <listitem><para>alert is raised if metric is outside start and end range
  245. (inclusive of endpoints)</para>
  246. </listitem>
  247. <listitem><para>if range starts with "@", then alert if inside this range
  248. (inclusive of endpoints)</para>
  249. </listitem>
  250. </orderedlist>
  251. <para>Note: Not all plugins are coded to expect ranges in this format. It is
  252. planned for a future release to
  253. provide standard libraries to parse and compare metrics against ranges. There
  254. will also be some work in providing multiple metrics.</para>
  255. </section>
  256. <section><title>Performance data</title>
  257. <para>Performance data is defined by Nagios as "everything after the | of the plugin output" -
  258. please refer to Nagios documentation for information on capturing this data to logfiles.
  259. However, it is the responsibility of the plugin writer to ensure the
  260. performance data is in a "Nagios plugins" format.
  261. This is the expected format:</para>
  262. <literallayout>
  263. 'label'=value[UOM];[warn];[crit];[min];[max]
  264. </literallayout>
  265. <para>Notes:</para>
  266. <orderedlist>
  267. <listitem><para>space separated list of label/value pairs</para>
  268. </listitem>
  269. <listitem><para>label can contain any characters</para>
  270. </listitem>
  271. <listitem><para>the single quotes for the label are optional. Required if
  272. spaces, = or ' are in the label</para>
  273. </listitem>
  274. <listitem><para>label length is arbitrary, but ideally the first 19 characters
  275. are unique (due to a limitation in RRD). Be aware of a limitation in the
  276. amount of data that NRPE returns to Nagios</para>
  277. </listitem>
  278. <listitem><para>to specify a quote character, use two single quotes</para>
  279. </listitem>
  280. <listitem><para>warn, crit, min or max may be null (for example, if the threshold is
  281. not defined or min and max do not apply). Trailing unfilled semicolons can be
  282. dropped</para>
  283. </listitem>
  284. <listitem><para>min and max are not required if UOM=%</para>
  285. </listitem>
  286. <listitem><para>value, min and max in class [-0-9.]. Must all be the
  287. same UOM</para>
  288. </listitem>
  289. <listitem><para>warn and crit are in the range format (see
  290. <xref linkend="thresholdformat">). Must be the same UOM</para>
  291. </listitem>
  292. <listitem><para>UOM (unit of measurement) is one of:</para>
  293. <orderedlist>
  294. <listitem><para>no unit specified - assume a number (int or float)
  295. of things (eg, users, processes, load averages)</para>
  296. </listitem>
  297. <listitem><para>s - seconds (also us, ms)</para></listitem>
  298. <listitem><para>% - percentage</para></listitem>
  299. <listitem><para>B - bytes (also KB, MB, TB)</para></listitem>
  300. <listitem><para>c - a continous counter (such as bytes
  301. transmitted on an interface)</para></listitem>
  302. </orderedlist>
  303. </listitem>
  304. </orderedlist>
  305. <para>It is up to third party programs to convert the Nagios plugins
  306. performance data into graphs.</para>
  307. </section>
  308. <section><title>Translations</title>
  309. <para>If possible, use translation tools for all output. Currently, most of the core C plugins
  310. use gettext for translation. General guidelines are:</para>
  311. <orderedlist>
  312. <listitem><para>short help is not translated</para></listitem>
  313. <listitem><para>long help has options in English language, but text translated</para></listitem>
  314. <listitem><para>"Copyright" kept in English</para></listitem>
  315. <listitem><para>copyright holder names kept in original text</para></listitem>
  316. </orderedlist>
  317. </section>
  318. </section>
  319. <section id="SysCmdAuxFiles"><title>System Commands and Auxiliary Files</title>
  320. <section><title>Don't execute system commands without specifying their
  321. full path</title>
  322. <para>Don't use exec(), popen(), etc. to execute external
  323. commands without explicity using the full path of the external
  324. program.</para>
  325. <para>Doing otherwise makes the plugin vulnerable to hijacking
  326. by a trojan horse earlier in the search path. See the main
  327. plugin distribution for examples on how this is done.</para>
  328. </section>
  329. <section><title>Use spopen() if external commands must be executed</title>
  330. <para>If you have to execute external commands from within your
  331. plugin and you're writing it in C, use the spopen() function
  332. that Karl DeBisschop has written.</para>
  333. <para>The code for spopen() and spclose() is included with the
  334. core plugin distribution.</para>
  335. </section>
  336. <section><title>Don't make temp files unless absolutely required</title>
  337. <para>If temp files are needed, make sure that the plugin will
  338. fail cleanly if the file can't be written (e.g., too few file
  339. handles, out of disk space, incorrect permissions, etc.) and
  340. delete the temp file when processing is complete.</para>
  341. </section>
  342. <section><title>Don't be tricked into following symlinks</title>
  343. <para>If your plugin opens any files, take steps to ensure that
  344. you are not following a symlink to another location on the
  345. system.</para>
  346. </section>
  347. <section><title>Validate all input</title>
  348. <para>use routines in utils.c or utils.pm and write more as needed</para>
  349. </section>
  350. </section>
  351. <section id="PerlPlugin"><title>Perl Plugins</title>
  352. <para>Perl plugins are coded a little more defensively than other
  353. plugins because of embedded Perl. When configured as such, embedded
  354. Perl Nagios (ePN) requires stricter use of the some of Perl's features.
  355. This section outlines some of the steps needed to use ePN
  356. effectively.</para>
  357. <orderedlist>
  358. <listitem><para> Do not use BEGIN and END blocks since they will be called
  359. only once (when Nagios starts and shuts down) with Embedded Perl (ePN). In
  360. particular, do not use BEGIN blocks to initialize variables.</para>
  361. </listitem>
  362. <listitem><para>To use utils.pm, you need to provide a full path to the
  363. module in order for it to work.</para>
  364. <literallayout>
  365. e.g.
  366. use lib "/usr/local/nagios/libexec";
  367. use utils qw(...);
  368. </literallayout>
  369. </listitem>
  370. <listitem><para>Perl scripts should be called with "-w"</para>
  371. </listitem>
  372. <listitem><para>All Perl plugins must compile cleanly under "use strict" - i.e. at
  373. least explicitly package names as in "$main::x" or predeclare every
  374. variable. </para>
  375. <para>Explicitly initialize each variable in use. Otherwise with
  376. caching enabled, the plugin will not be recompiled each time, and
  377. therefore Perl will not reinitialize all the variables. All old
  378. variable values will still be in effect.</para>
  379. </listitem>
  380. <listitem><para>Do not use &gt;DATA&lt; handles (these simply do not compile under ePN).</para>
  381. </listitem>
  382. <listitem><para>Do not use global variables in named subroutines. This is bad practise anyway, but with ePN the
  383. compiler will report an error "&lt;global_var&gt; will not stay shared ..". Values used by
  384. subroutines should be passed in the argument list.</para>
  385. </listitem>
  386. <listitem><para>If writing to a file (perhaps recording
  387. performance data) explicitly close close it. The plugin never
  388. calls <emphasis role="strong">exit</emphasis>; that is caught by
  389. p1.pl, so output streams are never closed.</para>
  390. </listitem>
  391. <listitem><para>As in <xref linkend="runtime"> all plugins need
  392. to monitor their runtime, specially if they are using network
  393. resources. Use of the <emphasis>alarm</emphasis> is recommended
  394. noting that some Perl modules (eg LWP) manage timers, so that an alarm
  395. set by a plugin using such a module is overwritten by the module.
  396. (workarounds are cunning (TM) or using the module timer)
  397. Plugins may import a default time out ($TIMEOUT) from utils.pm.
  398. </para>
  399. </listitem>
  400. <listitem><para>Perl plugins should import %ERRORS from utils.pm
  401. and then "exit $ERRORS{'OK'}" rather than "exit 0"
  402. </para>
  403. </listitem>
  404. </orderedlist>
  405. </section>
  406. <section id="runtime"><title>Runtime Timeouts</title>
  407. <para>Plugins have a very limited runtime - typically 10 sec.
  408. As a result, it is very important for plugins to maintain internal
  409. code to exit if runtime exceeds a threshold. </para>
  410. <para>All plugins should timeout gracefully, not just networking
  411. plugins. For instance, df may lock if you have automounted
  412. drives and your network fails - but on first glance, who'd think
  413. df could lock up like that. Plus, it should just be more error
  414. resistant to be able to time out rather than consume
  415. resources.</para>
  416. <section><title>Use DEFAULT_SOCKET_TIMEOUT</title>
  417. <para>All network plugins should use DEFAULT_SOCKET_TIMEOUT to timeout</para>
  418. </section>
  419. <section><title>Add alarms to network plugins</title>
  420. <para>If you write a plugin which communicates with another
  421. networked host, you should make sure to set an alarm() in your
  422. code that prevents the plugin from hanging due to abnormal
  423. socket closures, etc. Nagios takes steps to protect itself
  424. against unruly plugins that timeout, but any plugins you create
  425. should be well behaved on their own.</para>
  426. </section>
  427. </section>
  428. <section id="PlugOptions"><title>Plugin Options</title>
  429. <para>A well written plugin should have --help as a way to get
  430. verbose help. Code and output should try to respect the 80x25 size of a
  431. crt (remember when fixing stuff in the server room!)</para>
  432. <section><title>Option Processing</title>
  433. <para>For plugins written in C, we recommend the C standard
  434. getopt library for short options. Getopt_long is always available.
  435. </para>
  436. <para>For plugins written in Perl, we recommend Getopt::Long module.</para>
  437. <para>Positional arguments are strongly discouraged.</para>
  438. <para>There are a few reserved options that should not be used
  439. for other purposes:</para>
  440. <literallayout>
  441. -V version (--version)
  442. -h help (--help)
  443. -t timeout (--timeout)
  444. -w warning threshold (--warning)
  445. -c critical threshold (--critical)
  446. -H hostname (--hostname)
  447. -v verbose (--verbose)
  448. </literallayout>
  449. <para>In addition to the reserved options above, some other standard options are:</para>
  450. <literallayout>
  451. -C SNMP community (--community)
  452. -a authentication password (--authentication)
  453. -l login name (--logname)
  454. -p port or password (--port or --passwd/--password)monitors operational
  455. -u url or username (--url or --username)
  456. </literallayout>
  457. <para>Look at check_pgsql and check_procs to see how I currently
  458. think this can work. Standard options are:</para>
  459. <para>The option -V or --version should be present in all
  460. plugins. For C plugins it should result in a call to print_revision, a
  461. function in utils.c which takes two character arguments, the
  462. command name and the plugin revision.</para>
  463. <para>The -? option, or any other unparsable set of options,
  464. should print out a short usage statement. Character width should
  465. be 80 and less and no more that 23 lines should be printed (it
  466. should display cleanly on a dumb terminal in a server
  467. room).</para>
  468. <para>The option -h or --help should be present in all plugins.
  469. In C plugins, it should result in a call to print_help (or
  470. equivalent). The function print_help should call print_revision,
  471. then print_usage, then should provide detailed
  472. help. Help text should fit on an 80-character width display, but
  473. may run as many lines as needed.</para>
  474. <para>The option -v or --verbose should be present in all plugins.
  475. The user should be allowed to specify -v multiple times to increase
  476. the verbosity level, as described in <xref linkend="verboselevels">.</para>
  477. </section>
  478. <section>
  479. <title>Plugins with more than one type of threshold, or with
  480. threshold ranges</title>
  481. <para>Old style was to do things like -ct for critical time and
  482. -cv for critical value. That goes out the window with POSIX
  483. getopt. The allowable alternatives are:</para>
  484. <orderedlist>
  485. <listitem>
  486. <para>long options like -critical-time (or -ct and -cv, I
  487. suppose).</para>
  488. </listitem>
  489. <listitem>
  490. <para>repeated options like `check_load -w 10 -w 6 -w 4 -c
  491. 16 -c 10 -c 10`</para>
  492. </listitem>
  493. <listitem>
  494. <para>for brevity, the above can be expressed as `check_load
  495. -w 10,6,4 -c 16,10,10`</para>
  496. </listitem>
  497. <listitem>
  498. <para>ranges are expressed with colons as in `check_procs -C
  499. httpd -w 1:20 -c 1:30` which will warn above 20 instances,
  500. and critical at 0 and above 30</para>
  501. </listitem>
  502. <listitem>
  503. <para>lists are expressed with commas, so Jacob's check_nmap
  504. uses constructs like '-p 1000,1010,1050:1060,2000'</para>
  505. </listitem>
  506. <listitem>
  507. <para>If possible when writing lists, use tokens to make the
  508. list easy to remember and non-order dependent - so
  509. check_disk uses '-c 10000,10%' so that it is clear which is
  510. the precentage and which is the KB values (note that due to
  511. my own lack of foresight, that used to be '-c 10000:10%' but
  512. such constructs should all be changed for consistency,
  513. though providing reverse compatibility is fairly
  514. easy).</para>
  515. </listitem>
  516. </orderedlist>
  517. <para>As always, comments are welcome - making this consistent
  518. without a host of long options was quite a hassle, and I would
  519. suspect that there are flaws in this strategy.
  520. </para>
  521. </section>
  522. </section>
  523. <section id="CodingGuidelines"><title>Coding guidelines</title>
  524. <para>See <ulink url="http://www.gnu.org/prep/standards_toc.html">GNU
  525. Coding standards</ulink> for general guidelines.</para>
  526. <section><title>Comments</title>
  527. <para>You should use /* */ for comments and not // as some compilers
  528. do not handle the latter form.</para>
  529. <para>There should not be any named credits in the source code - contributors
  530. should be added
  531. into the AUTHORS file instead. The only exception to this is if a routine
  532. has been copied from another source.</para>
  533. </section>
  534. <section><title>CVS comments</title>
  535. <para>When adding CVS comments at commit time, you can use the following prefixes:
  536. <variablelist>
  537. <varlistentry><term>- comment</term>
  538. <listitem>
  539. <para>for a comment that can be removed from the Changelog</para>
  540. </listitem>
  541. </varlistentry>
  542. <varlistentry><term>* comment</term>
  543. <listitem>
  544. <para>for an important amendment to be included into a features list</para>
  545. </listitem>
  546. </varlistentry>
  547. </variablelist>
  548. </para>
  549. <para>If the change is due to a contribution, please quote the contributor's name
  550. and, if applicable, add the SourceForge Tracker number. Don't forget to
  551. update the AUTHORS file.</para>
  552. </section>
  553. </section>
  554. <section id="SubmittingChanges"><title>Submission of new plugins and patches</title>
  555. <section id="Patches"><title>Patches</title>
  556. <para>If you have a bug patch, please supply a unified or context diff against the
  557. version you are using. For new features, please supply a diff against
  558. the CVS HEAD version.</para>
  559. <para>Patches should be submitted via
  560. <ulink url="http://sourceforge.net/tracker/?group_id=29880&amp;atid=397599">SourceForge's
  561. tracker system for Nagiosplug patches</ulink>
  562. and be announced to the nagiosplug-devel mailing list.</para>
  563. <para>Submission of a patch implies that the submmitter acknowledges that they
  564. are the author of the code (or have permission from the author to release the code)
  565. and agree that the code can be released under the GPL. The copyright for the changes will
  566. then revert to the Nagios Plugin Development Team - this is required so that any copyright
  567. infringements can be investigated quickly without contacting a huge list of copyright holders.
  568. Credit will always be given for any patches through a THANKS file in the distribution.</para>
  569. </section>
  570. <section id="Newplugins"><title>New plugins</title>
  571. <para>If you would like others to use your plugins and have it included in
  572. the standard distribution, please include patches for the relevant
  573. configuration files, in particular "configure.in". Otherwise submitted
  574. plugins will be included in the contrib directory.</para>
  575. <para>Plugins in the contrib directory are going to be migrated to the
  576. standard plugins/plugin-scripts directory as time permits and per user
  577. requests. The minimum requirements are:</para>
  578. <orderedlist>
  579. <listitem>
  580. <para>The standard command options are supported (--help, --version,
  581. --timeout, --warning, --critical)</para>
  582. </listitem>
  583. <listitem>
  584. <para>It is determined to be not redundant (for instance, we would not
  585. add a new version of check_disk just because someone had provide
  586. a plugin that had perf checking - we would incorporate the features
  587. into an exisiting plugin)</para>
  588. </listitem>
  589. <listitem>
  590. <para>One of the developers has had the time to audit the code and declare
  591. it ready for core</para>
  592. </listitem>
  593. <listitem>
  594. <para>It should also follow code format guidelines, and use functions from
  595. utils (perl or c or sh) rather than cooking it's own</para>
  596. </listitem>
  597. </orderedlist>
  598. <para>New plugins should be submitted via
  599. <ulink url="http://sourceforge.net/tracker/?group_id=29880&amp;atid=541465">SourceForge's
  600. tracker system for Nagiosplug new plugins</ulink>
  601. and be announced to the nagiosplug-devel mailing list.</para>
  602. <para>For new plugins, provide a diff to add to the EXTRAS list (configure.in)
  603. unless you are fairly sure that the plugin will work for all platforms with
  604. no non-standard software added.</para>
  605. <para>If possible please submit a test harness. Documentation on sample
  606. tests coming soon.</para>
  607. </section>
  608. </section>
  609. <section id="UsingSourceforge"><title>Using Sourceforge</title>
  610. <table id="Projectmemberaccess"><title>Project Member Access</title>
  611. <tgroup cols="9">
  612. <thead>
  613. <row>
  614. <entry><para>Member type</para></entry>
  615. <entry><para>CVS Access</para></entry>
  616. <entry><para>Shell Access</para></entry>
  617. <entry><para>Release Tech</para></entry>
  618. <entry><para>Tracker Manager</para></entry>
  619. <entry><para>Task Manager</para></entry>
  620. <entry><para>Forums</para></entry>
  621. <entry><para>Doc Manager</para></entry>
  622. <entry><para>News</para></entry>
  623. <entry><para>Screenshots</para></entry>
  624. <entry><para>Notes</para></entry>
  625. </row>
  626. </thead>
  627. <tbody>
  628. <row>
  629. <entry><para>Translator</para></entry>
  630. <entry><para>Yes</para></entry>
  631. <entry><para>Yes</para></entry>
  632. <entry><para>No</para></entry>
  633. <entry><para>-</para></entry>
  634. <entry><para>-</para></entry>
  635. <entry><para>-</para></entry>
  636. <entry><para>-</para></entry>
  637. <entry><para>-</para></entry>
  638. <entry><para>-</para></entry>
  639. <entry><para>Add developer to CVSROOT/avail for translation files</para></entry>
  640. </row>
  641. <row>
  642. <entry><para>Developer</para></entry>
  643. <entry><para>Yes</para></entry>
  644. <entry><para>Yes</para></entry>
  645. <entry><para>No</para></entry>
  646. <entry><para>-</para></entry>
  647. <entry><para>A&amp;T</para></entry>
  648. <entry><para>Moderator</para></entry>
  649. <entry><para>Editor</para></entry>
  650. <entry><para>-</para></entry>
  651. <entry><para>-</para></entry>
  652. <entry><para>Need to set tracker access individually. Add developer to CVSROOT/avail for all files</para></entry>
  653. </row>
  654. </tbody>
  655. </tgroup>
  656. </table>
  657. <para>Add all members to the nagiosplug-team mailing list</para>
  658. </section>
  659. </article>
  660. </book>