diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/RELEASING.md | 12 | ||||
| -rw-r--r-- | doc/developer-guidelines.sgml | 167 | 
2 files changed, 88 insertions, 91 deletions
| diff --git a/doc/RELEASING.md b/doc/RELEASING.md index bcd2c5ac..432b1da1 100644 --- a/doc/RELEASING.md +++ b/doc/RELEASING.md | |||
| @@ -2,23 +2,23 @@ Releasing a New Monitoring Plugins Version | |||
| 2 | ========================================== | 2 | ========================================== | 
| 3 | 3 | ||
| 4 | Throughout this document, it is assumed that the current Monitoring | 4 | Throughout this document, it is assumed that the current Monitoring | 
| 5 | Plugins version is 2.2.1, and that we're about to publish version 2.3. | 5 | Plugins version is 2.3.3, and that we're about to publish version 2.4. | 
| 6 | It is also assumed that the official repository on GitHub is tracked | 6 | It is also assumed that the official repository on GitHub is tracked | 
| 7 | using the remote name `monitoring-plugins` (rather than `origin`). | 7 | using the remote name `monitoring-plugins` (rather than `origin`). | 
| 8 | 8 | ||
| 9 | Before you start | 9 | Before you start | 
| 10 | ---------------- | 10 | ---------------- | 
| 11 | 11 | ||
| 12 | - Check Travis CI status. | 12 | - Check Github Actions status. | 
| 13 | - Update local Git repository to the current `master` tip. For a | 13 | - Update local Git repository to the current `master` tip. For a | 
| 14 | maintenance release (e.g., version 2.3.2), update to the current | 14 | maintenance release (e.g., version 2.3.4), update to the current | 
| 15 | `maint-2.3` tip, instead. | 15 | `maint-2.3` tip, instead. | 
| 16 | 16 | ||
| 17 | Prepare and commit files | 17 | Prepare and commit files | 
| 18 | ------------------------ | 18 | ------------------------ | 
| 19 | 19 | ||
| 20 | - Update `configure.ac` and `NP-VERSION-GEN` with new version. | 20 | - Update `configure.ac` and `NP-VERSION-GEN` with new version. | 
| 21 | - Update `NEWS` from `git log --reverse v2.3.1..` output, and specify | 21 | - Update `NEWS` from `git log --reverse v2.3.3..` output, and specify | 
| 22 | the release version/date. | 22 | the release version/date. | 
| 23 | - Update `AUTHORS` if there are new team members. | 23 | - Update `AUTHORS` if there are new team members. | 
| 24 | - Update `THANKS.in` using `tools/update-thanks`. | 24 | - Update `THANKS.in` using `tools/update-thanks`. | 
| @@ -55,7 +55,7 @@ Build the tarball | |||
| 55 | ----------------- | 55 | ----------------- | 
| 56 | 56 | ||
| 57 | cd /tmp/plugins | 57 | cd /tmp/plugins | 
| 58 | tools/setup | 58 | tools/setup # requires docbook to be installed | 
| 59 | ./configure | 59 | ./configure | 
| 60 | make dist | 60 | make dist | 
| 61 | 61 | ||
| @@ -93,6 +93,6 @@ Announce new release | |||
| 93 | 93 | ||
| 94 | If you want to mention the number of contributors in the announcement: | 94 | If you want to mention the number of contributors in the announcement: | 
| 95 | 95 | ||
| 96 | git shortlog -s v2.3.1..v2.4 | wc -l | 96 | git shortlog -s v2.3.3..v2.4 | wc -l | 
| 97 | 97 | ||
| 98 | <!-- vim:set filetype=markdown textwidth=72: --> | 98 | <!-- vim:set filetype=markdown textwidth=72: --> | 
| diff --git a/doc/developer-guidelines.sgml b/doc/developer-guidelines.sgml index 6f31f365..37c963ed 100644 --- a/doc/developer-guidelines.sgml +++ b/doc/developer-guidelines.sgml | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | <pubdate>2013</pubdate> | 14 | <pubdate>2013</pubdate> | 
| 15 | <title>Monitoring Plugins Development Guidelines</title> | 15 | <title>Monitoring Plugins Development Guidelines</title> | 
| 16 | 16 | ||
| 17 | <revhistory> | 17 | <revhistory> | 
| 18 | <revision> | 18 | <revision> | 
| 19 | <revnumber>1796</revnumber> | 19 | <revnumber>1796</revnumber> | 
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | <preface id="preface"><title>Preface</title> | 32 | <preface id="preface"><title>Preface</title> | 
| 33 | <para>The purpose of this guidelines is to provide a reference for | 33 | <para>The purpose of this guidelines is to provide a reference for | 
| 34 | the plugin developers and encourage the standarization of the | 34 | the plugin developers and encourage the standardization of the | 
| 35 | different kind of plugins: C, shell, perl, python, etc.</para> | 35 | different kind of plugins: C, shell, perl, python, etc.</para> | 
| 36 | 36 | ||
| 37 | <para>Monitoring Plugins Development Guidelines Copyright (C) 2000-2013 | 37 | <para>Monitoring Plugins Development Guidelines Copyright (C) 2000-2013 | 
| @@ -72,14 +72,14 @@ | |||
| 72 | </section> | 72 | </section> | 
| 73 | 73 | ||
| 74 | <section id="PlugOutput"><title>Plugin Output for Nagios</title> | 74 | <section id="PlugOutput"><title>Plugin Output for Nagios</title> | 
| 75 | 75 | ||
| 76 | <para>You should always print something to STDOUT that tells if the | 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 - | 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 | 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 | 79 | the entire output to appear in a pager message, which will get chopped | 
| 80 | off after a certain length.</para> | 80 | off after a certain length.</para> | 
| 81 | 81 | ||
| 82 | <para>As Nagios does not capture stderr output, you should only output to | 82 | <para>As Nagios does not capture stderr output, you should only output to | 
| 83 | STDOUT and not print to STDERR.</para> | 83 | STDOUT and not print to STDERR.</para> | 
| 84 | 84 | ||
| 85 | <section><title>Print only one line of text</title> | 85 | <section><title>Print only one line of text</title> | 
| @@ -101,7 +101,7 @@ | |||
| 101 | SERVICE STATUS: Information text | 101 | SERVICE STATUS: Information text | 
| 102 | </literallayout> | 102 | </literallayout> | 
| 103 | <para>However, note that this is not a requirement of the API, so you cannot depend on this | 103 | <para>However, note that this is not a requirement of the API, so you cannot depend on this | 
| 104 | being an accurate reflection of the status of the service - the status should always | 104 | being an accurate reflection of the status of the service - the status should always | 
| 105 | be determined by the return code.</para> | 105 | be determined by the return code.</para> | 
| 106 | </section> | 106 | </section> | 
| 107 | 107 | ||
| @@ -148,7 +148,7 @@ | |||
| 148 | <para>Code and output should try to respect the 80x25 size of a | 148 | <para>Code and output should try to respect the 80x25 size of a | 
| 149 | crt (remember when fixing stuff in the server room!)</para> | 149 | crt (remember when fixing stuff in the server room!)</para> | 
| 150 | </section> | 150 | </section> | 
| 151 | 151 | ||
| 152 | <section><title>Plugin Return Codes</title> | 152 | <section><title>Plugin Return Codes</title> | 
| 153 | <para>The return codes below are based on the POSIX spec of returning | 153 | <para>The return codes below are based on the POSIX spec of returning | 
| 154 | a positive value. Netsaint prior to v0.0.7 supported non-POSIX | 154 | a positive value. Netsaint prior to v0.0.7 supported non-POSIX | 
| @@ -157,11 +157,11 @@ | |||
| 157 | 157 | ||
| 158 | <para>Note: Some plugins will on occasion print on STDOUT that an error | 158 | <para>Note: Some plugins will on occasion print on STDOUT that an error | 
| 159 | occurred and error code is 138 or 255 or some such number. These | 159 | occurred and error code is 138 or 255 or some such number. These | 
| 160 | are usually caused by plugins using system commands and having not | 160 | are usually caused by plugins using system commands and having not | 
| 161 | enough checks to catch unexpected output. Developers should include a | 161 | enough checks to catch unexpected output. Developers should include a | 
| 162 | default catch-all for system command output that returns an UNKNOWN | 162 | default catch-all for system command output that returns an UNKNOWN | 
| 163 | return code.</para> | 163 | return code.</para> | 
| 164 | 164 | ||
| 165 | <table id="ReturnCodes"><title>Plugin Return Codes</title> | 165 | <table id="ReturnCodes"><title>Plugin Return Codes</title> | 
| 166 | <tgroup cols="3"> | 166 | <tgroup cols="3"> | 
| 167 | <thead> | 167 | <thead> | 
| @@ -175,20 +175,20 @@ | |||
| 175 | <row> | 175 | <row> | 
| 176 | <entry align="center"><para>0</para></entry> | 176 | <entry align="center"><para>0</para></entry> | 
| 177 | <entry valign="middle"><para>OK</para></entry> | 177 | <entry valign="middle"><para>OK</para></entry> | 
| 178 | <entry><para>The plugin was able to check the service and it | 178 | <entry><para>The plugin was able to check the service and it | 
| 179 | appeared to be functioning properly</para></entry> | 179 | appeared to be functioning properly</para></entry> | 
| 180 | </row> | 180 | </row> | 
| 181 | <row> | 181 | <row> | 
| 182 | <entry align="center"><para>1</para></entry> | 182 | <entry align="center"><para>1</para></entry> | 
| 183 | <entry valign="middle"><para>Warning</para></entry> | 183 | <entry valign="middle"><para>Warning</para></entry> | 
| 184 | <entry><para>The plugin was able to check the service, but it | 184 | <entry><para>The plugin was able to check the service, but it | 
| 185 | appeared to be above some "warning" threshold or did not appear | 185 | appeared to be above some "warning" threshold or did not appear | 
| 186 | to be working properly</para></entry> | 186 | to be working properly</para></entry> | 
| 187 | </row> | 187 | </row> | 
| 188 | <row> | 188 | <row> | 
| 189 | <entry align="center"><para>2</para></entry> | 189 | <entry align="center"><para>2</para></entry> | 
| 190 | <entry valign="middle"><para>Critical</para></entry> | 190 | <entry valign="middle"><para>Critical</para></entry> | 
| 191 | <entry><para>The plugin detected that either the service was not | 191 | <entry><para>The plugin detected that either the service was not | 
| 192 | running or it was above some "critical" threshold</para></entry> | 192 | running or it was above some "critical" threshold</para></entry> | 
| 193 | </row> | 193 | </row> | 
| 194 | <row> | 194 | <row> | 
| @@ -207,7 +207,7 @@ | |||
| 207 | </tgroup> | 207 | </tgroup> | 
| 208 | </table> | 208 | </table> | 
| 209 | 209 | ||
| 210 | 210 | ||
| 211 | </section> | 211 | </section> | 
| 212 | 212 | ||
| 213 | <section id="thresholdformat"><title>Threshold and ranges</title> | 213 | <section id="thresholdformat"><title>Threshold and ranges</title> | 
| @@ -218,7 +218,7 @@ | |||
| 218 | set_thresholds(thresholds *, char *, char *) function to set the thresholds. | 218 | set_thresholds(thresholds *, char *, char *) function to set the thresholds. | 
| 219 | </para> | 219 | </para> | 
| 220 | <para>The theory is that the plugin will do some sort of check which returns | 220 | <para>The theory is that the plugin will do some sort of check which returns | 
| 221 | back a numerical value, or metric, which is then compared to the warning and | 221 | back a numerical value, or metric, which is then compared to the warning and | 
| 222 | critical thresholds. Use the get_status(double, thresholds *) function to | 222 | critical thresholds. Use the get_status(double, thresholds *) function to | 
| 223 | compare the value against the thresholds.</para> | 223 | compare the value against the thresholds.</para> | 
| 224 | <para>This is the generalised format for ranges:</para> | 224 | <para>This is the generalised format for ranges:</para> | 
| @@ -226,14 +226,14 @@ | |||
| 226 | <literallayout> | 226 | <literallayout> | 
| 227 | [@]start:end | 227 | [@]start:end | 
| 228 | </literallayout> | 228 | </literallayout> | 
| 229 | 229 | ||
| 230 | <para>Notes:</para> | 230 | <para>Notes:</para> | 
| 231 | <orderedlist> | 231 | <orderedlist> | 
| 232 | <listitem><para>start ≤ end</para> | 232 | <listitem><para>start ≤ end</para> | 
| 233 | </listitem> | 233 | </listitem> | 
| 234 | <listitem><para>start and ":" is not required if start=0</para> | 234 | <listitem><para>start and ":" is not required if start=0</para> | 
| 235 | </listitem> | 235 | </listitem> | 
| 236 | <listitem><para>if range is of format "start:" and end is not specified, | 236 | <listitem><para>if range is of format "start:" and end is not specified, | 
| 237 | assume end is infinity</para> | 237 | assume end is infinity</para> | 
| 238 | </listitem> | 238 | </listitem> | 
| 239 | <listitem><para>to specify negative infinity, use "~"</para> | 239 | <listitem><para>to specify negative infinity, use "~"</para> | 
| @@ -245,7 +245,7 @@ | |||
| 245 | (inclusive of endpoints)</para> | 245 | (inclusive of endpoints)</para> | 
| 246 | </listitem> | 246 | </listitem> | 
| 247 | </orderedlist> | 247 | </orderedlist> | 
| 248 | 248 | ||
| 249 | <para>Note: Not all plugins are coded to expect ranges in this format yet. | 249 | <para>Note: Not all plugins are coded to expect ranges in this format yet. | 
| 250 | There will be some work in providing multiple metrics.</para> | 250 | There will be some work in providing multiple metrics.</para> | 
| 251 | 251 | ||
| @@ -344,7 +344,7 @@ | |||
| 344 | </listitem> | 344 | </listitem> | 
| 345 | <listitem><para>label can contain any characters except the equals sign or single quote (')</para> | 345 | <listitem><para>label can contain any characters except the equals sign or single quote (')</para> | 
| 346 | </listitem> | 346 | </listitem> | 
| 347 | <listitem><para>the single quotes for the label are optional. Required if | 347 | <listitem><para>the single quotes for the label are optional. Required if | 
| 348 | spaces are in the label</para> | 348 | spaces are in the label</para> | 
| 349 | </listitem> | 349 | </listitem> | 
| 350 | <listitem><para>label length is arbitrary, but ideally the first 19 characters | 350 | <listitem><para>label length is arbitrary, but ideally the first 19 characters | 
| @@ -353,7 +353,7 @@ | |||
| 353 | </listitem> | 353 | </listitem> | 
| 354 | <listitem><para>to specify a quote character, use two single quotes</para> | 354 | <listitem><para>to specify a quote character, use two single quotes</para> | 
| 355 | </listitem> | 355 | </listitem> | 
| 356 | <listitem><para>warn, crit, min or max may be null (for example, if the threshold is | 356 | <listitem><para>warn, crit, min or max may be null (for example, if the threshold is | 
| 357 | not defined or min and max do not apply). Trailing unfilled semicolons can be | 357 | not defined or min and max do not apply). Trailing unfilled semicolons can be | 
| 358 | dropped</para> | 358 | dropped</para> | 
| 359 | </listitem> | 359 | </listitem> | 
| @@ -363,18 +363,18 @@ | |||
| 363 | same UOM. value may be a literal "U" instead, this would indicate that the | 363 | same UOM. value may be a literal "U" instead, this would indicate that the | 
| 364 | actual value couldn't be determined</para> | 364 | actual value couldn't be determined</para> | 
| 365 | </listitem> | 365 | </listitem> | 
| 366 | <listitem><para>warn and crit are in the range format (see | 366 | <listitem><para>warn and crit are in the range format (see | 
| 367 | <xref linkend="thresholdformat">). Must be the same UOM</para> | 367 | <xref linkend="thresholdformat">). Must be the same UOM</para> | 
| 368 | </listitem> | 368 | </listitem> | 
| 369 | <listitem><para>UOM (unit of measurement) is one of:</para> | 369 | <listitem><para>UOM (unit of measurement) is one of:</para> | 
| 370 | <orderedlist> | 370 | <orderedlist> | 
| 371 | <listitem><para>no unit specified - assume a number (int or float) | 371 | <listitem><para>no unit specified - assume a number (int or float) | 
| 372 | of things (eg, users, processes, load averages)</para> | 372 | of things (eg, users, processes, load averages)</para> | 
| 373 | </listitem> | 373 | </listitem> | 
| 374 | <listitem><para>s - seconds (also us, ms)</para></listitem> | 374 | <listitem><para>s - seconds (also us, ms)</para></listitem> | 
| 375 | <listitem><para>% - percentage</para></listitem> | 375 | <listitem><para>% - percentage</para></listitem> | 
| 376 | <listitem><para>B - bytes (also KB, MB, TB)</para></listitem> | 376 | <listitem><para>B - bytes (also KB, MB, TB)</para></listitem> | 
| 377 | <listitem><para>c - a continous counter (such as bytes | 377 | <listitem><para>c - a continuous counter (such as bytes | 
| 378 | transmitted on an interface)</para></listitem> | 378 | transmitted on an interface)</para></listitem> | 
| 379 | </orderedlist> | 379 | </orderedlist> | 
| 380 | </listitem> | 380 | </listitem> | 
| @@ -385,9 +385,9 @@ | |||
| 385 | </section> | 385 | </section> | 
| 386 | 386 | ||
| 387 | <section><title>Translations</title> | 387 | <section><title>Translations</title> | 
| 388 | <para>If possible, use translation tools for all output to respect the user's language | 388 | <para>If possible, use translation tools for all output to respect the user's language | 
| 389 | settings. See <xref linkend="translationsdevelopers"> for guidelines | 389 | settings. See <xref linkend="translationsdevelopers"> for guidelines | 
| 390 | for the core plugins. | 390 | for the core plugins. | 
| 391 | </para> | 391 | </para> | 
| 392 | </section> | 392 | </section> | 
| 393 | </section> | 393 | </section> | 
| @@ -397,7 +397,7 @@ | |||
| 397 | <section><title>Don't execute system commands without specifying their | 397 | <section><title>Don't execute system commands without specifying their | 
| 398 | full path</title> | 398 | full path</title> | 
| 399 | <para>Don't use exec(), popen(), etc. to execute external | 399 | <para>Don't use exec(), popen(), etc. to execute external | 
| 400 | commands without explicity using the full path of the external | 400 | commands without explicitly using the full path of the external | 
| 401 | program.</para> | 401 | program.</para> | 
| 402 | 402 | ||
| 403 | <para>Doing otherwise makes the plugin vulnerable to hijacking | 403 | <para>Doing otherwise makes the plugin vulnerable to hijacking | 
| @@ -436,7 +436,7 @@ | |||
| 436 | </section> | 436 | </section> | 
| 437 | 437 | ||
| 438 | </section> | 438 | </section> | 
| 439 | 439 | ||
| 440 | 440 | ||
| 441 | 441 | ||
| 442 | 442 | ||
| @@ -447,17 +447,17 @@ | |||
| 447 | Perl Nagios (ePN) requires stricter use of the some of Perl's features. | 447 | Perl Nagios (ePN) requires stricter use of the some of Perl's features. | 
| 448 | This section outlines some of the steps needed to use ePN | 448 | This section outlines some of the steps needed to use ePN | 
| 449 | effectively.</para> | 449 | effectively.</para> | 
| 450 | 450 | ||
| 451 | <orderedlist> | 451 | <orderedlist> | 
| 452 | 452 | ||
| 453 | <listitem><para> Do not use BEGIN and END blocks since they will be called | 453 | <listitem><para> Do not use BEGIN and END blocks since they will be called | 
| 454 | only once (when Nagios starts and shuts down) with Embedded Perl (ePN). In | 454 | only once (when Nagios starts and shuts down) with Embedded Perl (ePN). In | 
| 455 | particular, do not use BEGIN blocks to initialize variables.</para> | 455 | particular, do not use BEGIN blocks to initialize variables.</para> | 
| 456 | </listitem> | 456 | </listitem> | 
| 457 | 457 | ||
| 458 | <listitem><para>To use utils.pm, you need to provide a full path to the | 458 | <listitem><para>To use utils.pm, you need to provide a full path to the | 
| 459 | module in order for it to work.</para> | 459 | module in order for it to work.</para> | 
| 460 | 460 | ||
| 461 | <literallayout> | 461 | <literallayout> | 
| 462 | e.g. | 462 | e.g. | 
| 463 | use lib "/usr/local/nagios/libexec"; | 463 | use lib "/usr/local/nagios/libexec"; | 
| @@ -467,24 +467,24 @@ | |||
| 467 | 467 | ||
| 468 | <listitem><para>Perl scripts should be called with "-w"</para> | 468 | <listitem><para>Perl scripts should be called with "-w"</para> | 
| 469 | </listitem> | 469 | </listitem> | 
| 470 | 470 | ||
| 471 | <listitem><para>All Perl plugins must compile cleanly under "use strict" - i.e. at | 471 | <listitem><para>All Perl plugins must compile cleanly under "use strict" - i.e. at | 
| 472 | least explicitly package names as in "$main::x" or predeclare every | 472 | least explicitly package names as in "$main::x" or predeclare every | 
| 473 | variable. </para> | 473 | variable. </para> | 
| 474 | 474 | ||
| 475 | 475 | ||
| 476 | <para>Explicitly initialize each variable in use. Otherwise with | 476 | <para>Explicitly initialize each variable in use. Otherwise with | 
| 477 | caching enabled, the plugin will not be recompiled each time, and | 477 | caching enabled, the plugin will not be recompiled each time, and | 
| 478 | therefore Perl will not reinitialize all the variables. All old | 478 | therefore Perl will not reinitialize all the variables. All old | 
| 479 | variable values will still be in effect.</para> | 479 | variable values will still be in effect.</para> | 
| 480 | </listitem> | 480 | </listitem> | 
| 481 | 481 | ||
| 482 | <listitem><para>Do not use >DATA< handles (these simply do not compile under ePN).</para> | 482 | <listitem><para>Do not use >DATA< handles (these simply do not compile under ePN).</para> | 
| 483 | </listitem> | 483 | </listitem> | 
| 484 | 484 | ||
| 485 | <listitem><para>Do not use global variables in named subroutines. This is bad practise anyway, but with ePN the | 485 | <listitem><para>Do not use global variables in named subroutines. This is bad practise anyway, but with ePN the | 
| 486 | compiler will report an error "<global_var> will not stay shared ..". Values used by | 486 | compiler will report an error "<global_var> will not stay shared ..". Values used by | 
| 487 | subroutines should be passed in the argument list.</para> | 487 | subroutines should be passed in the argument list.</para> | 
| 488 | </listitem> | 488 | </listitem> | 
| 489 | 489 | ||
| 490 | <listitem><para>If writing to a file (perhaps recording | 490 | <listitem><para>If writing to a file (perhaps recording | 
| @@ -492,8 +492,8 @@ | |||
| 492 | calls <emphasis role="strong">exit</emphasis>; that is caught by | 492 | calls <emphasis role="strong">exit</emphasis>; that is caught by | 
| 493 | p1.pl, so output streams are never closed.</para> | 493 | p1.pl, so output streams are never closed.</para> | 
| 494 | </listitem> | 494 | </listitem> | 
| 495 | 495 | ||
| 496 | <listitem><para>As in <xref linkend="runtime"> all plugins need | 496 | <listitem><para>As in <xref linkend="runtime"> all plugins need | 
| 497 | to monitor their runtime, specially if they are using network | 497 | to monitor their runtime, specially if they are using network | 
| 498 | resources. Use of the <emphasis>alarm</emphasis> is recommended | 498 | resources. Use of the <emphasis>alarm</emphasis> is recommended | 
| 499 | noting that some Perl modules (eg LWP) manage timers, so that an alarm | 499 | noting that some Perl modules (eg LWP) manage timers, so that an alarm | 
| @@ -507,9 +507,9 @@ | |||
| 507 | and then "exit $ERRORS{'OK'}" rather than "exit 0" | 507 | and then "exit $ERRORS{'OK'}" rather than "exit 0" | 
| 508 | </para> | 508 | </para> | 
| 509 | </listitem> | 509 | </listitem> | 
| 510 | 510 | ||
| 511 | </orderedlist> | 511 | </orderedlist> | 
| 512 | 512 | ||
| 513 | </section> | 513 | </section> | 
| 514 | 514 | ||
| 515 | <section id="runtime"><title>Runtime Timeouts</title> | 515 | <section id="runtime"><title>Runtime Timeouts</title> | 
| @@ -524,14 +524,14 @@ | |||
| 524 | df could lock up like that. Plus, it should just be more error | 524 | df could lock up like that. Plus, it should just be more error | 
| 525 | resistant to be able to time out rather than consume | 525 | resistant to be able to time out rather than consume | 
| 526 | resources.</para> | 526 | resources.</para> | 
| 527 | 527 | ||
| 528 | <section><title>Use DEFAULT_SOCKET_TIMEOUT</title> | 528 | <section><title>Use DEFAULT_SOCKET_TIMEOUT</title> | 
| 529 | 529 | ||
| 530 | <para>All network plugins should use DEFAULT_SOCKET_TIMEOUT to timeout</para> | 530 | <para>All network plugins should use DEFAULT_SOCKET_TIMEOUT to timeout</para> | 
| 531 | 531 | ||
| 532 | </section> | 532 | </section> | 
| 533 | 533 | ||
| 534 | 534 | ||
| 535 | <section><title>Add alarms to network plugins</title> | 535 | <section><title>Add alarms to network plugins</title> | 
| 536 | 536 | ||
| 537 | <para>If you write a plugin which communicates with another | 537 | <para>If you write a plugin which communicates with another | 
| @@ -543,16 +543,16 @@ | |||
| 543 | 543 | ||
| 544 | </section> | 544 | </section> | 
| 545 | 545 | ||
| 546 | 546 | ||
| 547 | 547 | ||
| 548 | </section> | 548 | </section> | 
| 549 | 549 | ||
| 550 | <section id="PlugOptions"><title>Plugin Options</title> | 550 | <section id="PlugOptions"><title>Plugin Options</title> | 
| 551 | 551 | ||
| 552 | <para>A well written plugin should have --help as a way to get | 552 | <para>A well written plugin should have --help as a way to get | 
| 553 | verbose help. Code and output should try to respect the 80x25 size of a | 553 | verbose help. Code and output should try to respect the 80x25 size of a | 
| 554 | crt (remember when fixing stuff in the server room!)</para> | 554 | crt (remember when fixing stuff in the server room!)</para> | 
| 555 | 555 | ||
| 556 | <section><title>Option Processing</title> | 556 | <section><title>Option Processing</title> | 
| 557 | 557 | ||
| 558 | <para>For plugins written in C, we recommend the C standard | 558 | <para>For plugins written in C, we recommend the C standard | 
| @@ -585,11 +585,11 @@ | |||
| 585 | -p port or password (--port or --passwd/--password)monitors operational | 585 | -p port or password (--port or --passwd/--password)monitors operational | 
| 586 | -u url or username (--url or --username) | 586 | -u url or username (--url or --username) | 
| 587 | </literallayout> | 587 | </literallayout> | 
| 588 | 588 | ||
| 589 | <para>Look at check_pgsql and check_procs to see how I currently | 589 | <para>Look at check_pgsql and check_procs to see how I currently | 
| 590 | think this can work. Standard options are:</para> | 590 | think this can work. Standard options are:</para> | 
| 591 | 591 | ||
| 592 | 592 | ||
| 593 | <para>The option -V or --version should be present in all | 593 | <para>The option -V or --version should be present in all | 
| 594 | plugins. For C plugins it should result in a call to print_revision, a | 594 | plugins. For C plugins it should result in a call to print_revision, a | 
| 595 | function in utils.c which takes two character arguments, the | 595 | function in utils.c which takes two character arguments, the | 
| @@ -603,7 +603,7 @@ | |||
| 603 | 603 | ||
| 604 | <para>The option -h or --help should be present in all plugins. | 604 | <para>The option -h or --help should be present in all plugins. | 
| 605 | In C plugins, it should result in a call to print_help (or | 605 | In C plugins, it should result in a call to print_help (or | 
| 606 | equivalent). The function print_help should call print_revision, | 606 | equivalent). The function print_help should call print_revision, | 
| 607 | then print_usage, then should provide detailed | 607 | then print_usage, then should provide detailed | 
| 608 | help. Help text should fit on an 80-character width display, but | 608 | help. Help text should fit on an 80-character width display, but | 
| 609 | may run as many lines as needed.</para> | 609 | may run as many lines as needed.</para> | 
| @@ -655,7 +655,7 @@ | |||
| 655 | <para>If possible when writing lists, use tokens to make the | 655 | <para>If possible when writing lists, use tokens to make the | 
| 656 | list easy to remember and non-order dependent - so | 656 | list easy to remember and non-order dependent - so | 
| 657 | check_disk uses '-c 10000,10%' so that it is clear which is | 657 | check_disk uses '-c 10000,10%' so that it is clear which is | 
| 658 | the precentage and which is the KB values (note that due to | 658 | the percentage and which is the KB values (note that due to | 
| 659 | my own lack of foresight, that used to be '-c 10000:10%' but | 659 | my own lack of foresight, that used to be '-c 10000:10%' but | 
| 660 | such constructs should all be changed for consistency, | 660 | such constructs should all be changed for consistency, | 
| 661 | though providing reverse compatibility is fairly | 661 | though providing reverse compatibility is fairly | 
| @@ -666,7 +666,7 @@ | |||
| 666 | 666 | ||
| 667 | <para>As always, comments are welcome - making this consistent | 667 | <para>As always, comments are welcome - making this consistent | 
| 668 | without a host of long options was quite a hassle, and I would | 668 | without a host of long options was quite a hassle, and I would | 
| 669 | suspect that there are flaws in this strategy. | 669 | suspect that there are flaws in this strategy. | 
| 670 | </para> | 670 | </para> | 
| 671 | </section> | 671 | </section> | 
| 672 | </section> | 672 | </section> | 
| @@ -678,7 +678,7 @@ create and update test cases where possible. | |||
| 678 | </para> | 678 | </para> | 
| 679 | 679 | ||
| 680 | <para> | 680 | <para> | 
| 681 | To run a test, from the top level directory, run "make test". This will run | 681 | To run a test, from the top level directory, run "make test". This will run | 
| 682 | all the current tests and report an overall success rate. | 682 | all the current tests and report an overall success rate. | 
| 683 | </para> | 683 | </para> | 
| 684 | 684 | ||
| @@ -686,7 +686,7 @@ all the current tests and report an overall success rate. | |||
| 686 | <para>These use perl's Test::More. To do a one time test, run "cd plugins && perl t/check_disk.t". | 686 | <para>These use perl's Test::More. To do a one time test, run "cd plugins && perl t/check_disk.t". | 
| 687 | </para> | 687 | </para> | 
| 688 | 688 | ||
| 689 | <para>There will somtimes be failures seen in this output which are known failures that | 689 | <para>There will sometimes be failures seen in this output which are known failures that | 
| 690 | need to be fixed. As long as the return code is 0, it will be reported as "test pass". | 690 | need to be fixed. As long as the return code is 0, it will be reported as "test pass". | 
| 691 | (If you have a fix so that the specific test passes, that will be gratefully received!) | 691 | (If you have a fix so that the specific test passes, that will be gratefully received!) | 
| 692 | </para> | 692 | </para> | 
| @@ -697,7 +697,7 @@ This runs the test in a summary format. | |||
| 697 | </para> | 697 | </para> | 
| 698 | 698 | ||
| 699 | <para> | 699 | <para> | 
| 700 | For a good and amusing tutorial on using Test::More, see this | 700 | For a good and amusing tutorial on using Test::More, see this | 
| 701 | <ulink url="http://search.cpan.org/dist/Test-Simple/lib/Test/Tutorial.pod"> | 701 | <ulink url="http://search.cpan.org/dist/Test-Simple/lib/Test/Tutorial.pod"> | 
| 702 | link</ulink> | 702 | link</ulink> | 
| 703 | </para> | 703 | </para> | 
| @@ -706,16 +706,16 @@ link</ulink> | |||
| 706 | 706 | ||
| 707 | <section><title>Testing the C library functions</title> | 707 | <section><title>Testing the C library functions</title> | 
| 708 | <para> | 708 | <para> | 
| 709 | We use <ulink url="http://jc.ngo.org.uk/trac-bin/trac.cgi/wiki/LibTap">the libtap library</ulink>, which gives | 709 | We use <ulink url="http://jc.ngo.org.uk/trac-bin/trac.cgi/wiki/LibTap">the libtap library</ulink>, which gives | 
| 710 | perl's TAP | 710 | perl's TAP | 
| 711 | (Test Anything Protocol) output. This is used by the FreeBSD team for their regression testing. | 711 | (Test Anything Protocol) output. This is used by the FreeBSD team for their regression testing. | 
| 712 | </para> | 712 | </para> | 
| 713 | 713 | ||
| 714 | <para> | 714 | <para> | 
| 715 | To run tests using the libtap library, download the latest tar ball and extract. | 715 | To run tests using the libtap library, download the latest tar ball and extract. | 
| 716 | There is a problem with tap-1.01 where | 716 | There is a problem with tap-1.01 where | 
| 717 | <ulink url="http://jc.ngo.org.uk/trac-bin/trac.cgi/ticket/25">pthread support doesn't appear to work</ulink> | 717 | <ulink url="http://jc.ngo.org.uk/trac-bin/trac.cgi/ticket/25">pthread support doesn't appear to work</ulink> | 
| 718 | properly on non-FreeBSD systems. Install with 'CPPFLAGS="-UHAVE_LIBPTHREAD" ./configure && make && make check && make install'. | 718 | properly on non-FreeBSD systems. Install with 'CPPFLAGS="-UHAVE_LIBPTHREAD" ./configure && make && make check && make install'. | 
| 719 | </para> | 719 | </para> | 
| 720 | 720 | ||
| 721 | <para> | 721 | <para> | 
| @@ -729,24 +729,21 @@ setup the tests. Run "make test" to run all the tests. | |||
| 729 | <para>See <ulink url="http://www.gnu.org/prep/standards_toc.html">GNU | 729 | <para>See <ulink url="http://www.gnu.org/prep/standards_toc.html">GNU | 
| 730 | Coding standards</ulink> for general guidelines.</para> | 730 | Coding standards</ulink> for general guidelines.</para> | 
| 731 | <section><title>C coding</title> | 731 | <section><title>C coding</title> | 
| 732 | |||
| 733 | <para>Variables should be declared at the beginning of code blocks and | ||
| 734 | not inline because of portability with older compilers.</para> | ||
| 735 | 732 | ||
| 736 | <para>You should use /* */ for comments and not // as some compilers | 733 | <para>Variables should be declared at the beginning of code blocks and | 
| 737 | do not handle the latter form.</para> | 734 | not inline because of portability with older compilers.</para> | 
| 738 | 735 | ||
| 739 | <para>You should also avoid using the type "bool" and its values | 736 | <para>You should use the type "bool" and its values | 
| 740 | "true" and "false". Instead use the "int" type and the plugins' own | 737 | "true" and "false" instead of the "int" type for booleans. | 
| 741 | "TRUE"/"FALSE" values to keep the code uniformly.</para> | 738 | </para> | 
| 742 | </section> | 739 | </section> | 
| 743 | 740 | ||
| 744 | <section><title>Crediting sources</title> | 741 | <section><title>Crediting sources</title> | 
| 745 | <para>If you have copied a routine from another source, make sure the licence | 742 | <para>If you have copied a routine from another source, make sure the licence | 
| 746 | from your source allows this. Add a comment referencing the ACKNOWLEDGEMENTS | 743 | from your source allows this. Add a comment referencing the ACKNOWLEDGEMENTS | 
| 747 | file, where you can put more detail about the source.</para> | 744 | file, where you can put more detail about the source.</para> | 
| 748 | <para>For contributed code, do not add any named credits in the source code | 745 | <para>For contributed code, do not add any named credits in the source code | 
| 749 | - contributors should be added into the THANKS.in file instead. | 746 | - contributors should be added into the THANKS.in file instead. | 
| 750 | </para> | 747 | </para> | 
| 751 | </section> | 748 | </section> | 
| 752 | 749 | ||
| @@ -809,11 +806,11 @@ setup the tests. Run "make test" to run all the tests. | |||
| 809 | 806 | ||
| 810 | 807 | ||
| 811 | <section id="Contributedplugins"><title>Contributed plugins</title> | 808 | <section id="Contributedplugins"><title>Contributed plugins</title> | 
| 812 | <para>Plugins that have been contributed to the project and | 809 | <para>Plugins that have been contributed to the project and | 
| 813 | distributed with the Monitoring Plugins files are held in the contrib/ directory and are not installed | 810 | distributed with the Monitoring Plugins files are held in the contrib/ directory and are not installed | 
| 814 | by default. These plugins are not officially supported by the team. | 811 | by default. These plugins are not officially supported by the team. | 
| 815 | The current policy is that these plugins should be owned and maintained by the original | 812 | The current policy is that these plugins should be owned and maintained by the original | 
| 816 | contributor, preferably hosted on <ulink url="http://monitoringexchange.org">Monitoring Exchange</ulink>. | 813 | contributor, preferably hosted on <ulink url="https://exchange.icinga.com/">Icinga Exchange</ulink>. | 
| 817 | </para> | 814 | </para> | 
| 818 | <para>If patches or bugs are raised to an contributed plugin, we will start communications with the | 815 | <para>If patches or bugs are raised to an contributed plugin, we will start communications with the | 
| 819 | original contributor, but seek to remove the plugin from our distribution. | 816 | original contributor, but seek to remove the plugin from our distribution. | 
| @@ -824,11 +821,11 @@ setup the tests. Run "make test" to run all the tests. | |||
| 824 | 821 | ||
| 825 | <section id="Newplugins"><title>New plugins</title> | 822 | <section id="Newplugins"><title>New plugins</title> | 
| 826 | <para>If you would like others to use your plugins, please add it to | 823 | <para>If you would like others to use your plugins, please add it to | 
| 827 | the official 3rd party plugin repository, | 824 | the official 3rd party plugin repository, | 
| 828 | <ulink url="http://monitoringexchange.org">Monitoring Exchange</ulink>. | 825 | <ulink url="https://exchange.icinga.com/">Icinga Exchange</ulink>. | 
| 829 | </para> | 826 | </para> | 
| 830 | 827 | ||
| 831 | <para>We are not accepting requests for inclusion of plugins into | 828 | <para>We are not accepting requests for inclusion of plugins into | 
| 832 | our distribution at the moment, but when we do, these are the minimum | 829 | our distribution at the moment, but when we do, these are the minimum | 
| 833 | requirements: | 830 | requirements: | 
| 834 | </para> | 831 | </para> | 
| @@ -843,10 +840,10 @@ setup the tests. Run "make test" to run all the tests. | |||
| 843 | --timeout, --warning, --critical)</para> | 840 | --timeout, --warning, --critical)</para> | 
| 844 | </listitem> | 841 | </listitem> | 
| 845 | <listitem> | 842 | <listitem> | 
| 846 | <para>It is determined to be not redundant (for instance, we would not | 843 | <para>It is determined to be not redundant (for instance, we would not | 
| 847 | add a new version of check_disk just because someone had provide | 844 | add a new version of check_disk just because someone had provide | 
| 848 | a plugin that had perf checking - we would incorporate the features | 845 | a plugin that had perf checking - we would incorporate the features | 
| 849 | into an exisiting plugin)</para> | 846 | into an existing plugin)</para> | 
| 850 | </listitem> | 847 | </listitem> | 
| 851 | <listitem> | 848 | <listitem> | 
| 852 | <para>One of the developers has had the time to audit the code and declare | 849 | <para>One of the developers has had the time to audit the code and declare | 
| @@ -857,7 +854,7 @@ setup the tests. Run "make test" to run all the tests. | |||
| 857 | utils (perl or c or sh) rather than using its own</para> | 854 | utils (perl or c or sh) rather than using its own</para> | 
| 858 | </listitem> | 855 | </listitem> | 
| 859 | <listitem> | 856 | <listitem> | 
| 860 | <para>Includes patches to configure.in if required (via the EXTRAS list if | 857 | <para>Includes patches to configure.in if required (via the EXTRAS list if | 
| 861 | it will only work on some platforms)</para> | 858 | it will only work on some platforms)</para> | 
| 862 | </listitem> | 859 | </listitem> | 
| 863 | <listitem> | 860 | <listitem> | 
| @@ -870,5 +867,5 @@ utils (perl or c or sh) rather than using its own</para> | |||
| 870 | 867 | ||
| 871 | </section> | 868 | </section> | 
| 872 | </article> | 869 | </article> | 
| 873 | 870 | ||
| 874 | </book> | 871 | </book> | 
