diff options
Diffstat (limited to 'web/input/doc/extra-opts.md')
-rw-r--r-- | web/input/doc/extra-opts.md | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/web/input/doc/extra-opts.md b/web/input/doc/extra-opts.md new file mode 100644 index 0000000..542c199 --- /dev/null +++ b/web/input/doc/extra-opts.md | |||
@@ -0,0 +1,72 @@ | |||
1 | title: Extra-Opts | ||
2 | parent: Documentation | ||
3 | --- | ||
4 | |||
5 | # Extra-Opts | ||
6 | |||
7 | Starting with the 1.4.12 release, Nagios C plugins support reading | ||
8 | configuration options from a configuration file. This needs to be enabled at | ||
9 | compile-time for now (`--enable-extra-opts`) and will be enabled by default in | ||
10 | the future. Perl plugins using the Nagios::Plugin module have this support | ||
11 | since version 0.16. | ||
12 | |||
13 | You can easily know if a plugin supports *extra-opts* by checking the `--help` | ||
14 | output for the `--extra-opts` option. Once compiled in, the `--extra-opts` | ||
15 | plugin option allows reading extra options from a config file. The syntax for | ||
16 | the command is: | ||
17 | |||
18 | --extra-opts=[section][@file] | ||
19 | |||
20 | Some examples: | ||
21 | |||
22 | * Read `special_opts` section of default config file: | ||
23 | |||
24 | ./check_stuff --extra-opts=special_opts | ||
25 | |||
26 | * Read `special_opts` section of `/etc/myconfig.ini`: | ||
27 | |||
28 | ./check_stuff --extra-opts=special_opts@/etc/myconfig.ini | ||
29 | |||
30 | * Read `check_stuff` section of `/etc/myconfig.ini`: | ||
31 | |||
32 | ./check_stuff --extra-opts=@/etc/myconfig.ini | ||
33 | |||
34 | * Read `check_stuff` section of default config file and use additional | ||
35 | arguments along with the other specified arguments (*extra-opts* arguments | ||
36 | are always processed first no matter where `--extra-opts` appears on the | ||
37 | command line): | ||
38 | |||
39 | ./check_stuff --extra-opts -jk --some-other-opt | ||
40 | |||
41 | The default nagios plugins file is used if no explicit filename is given. The | ||
42 | current standard locations checked are: | ||
43 | |||
44 | * `/etc/nagios/plugins.ini` | ||
45 | * `/usr/local/nagios/etc/plugins.ini` | ||
46 | * `/usr/local/etc/nagios/plugins.ini` | ||
47 | * `/etc/opt/nagios/plugins.ini` | ||
48 | * `/etc/nagios-plugins.ini` | ||
49 | * `/usr/local/etc/nagios-plugins.ini` | ||
50 | * `/etc/opt/nagios-plugins.ini` | ||
51 | |||
52 | To use a custom location, set a `NAGIOS_CONFIG_PATH` environment variable to | ||
53 | the set of directories that should be checked (this is a colon-separated list | ||
54 | just like `PATH`). The first `plugins.ini` or `nagios-plugins.ini` file found | ||
55 | in these directories will be used. | ||
56 | |||
57 | To specify an option without parameter, you can use a key without value, but | ||
58 | the equal sign must remain, for example: | ||
59 | |||
60 | allow-regex= | ||
61 | |||
62 | Also note that repeated keys are allowed within sections just like you can | ||
63 | repeat arguments on the command line. | ||
64 | |||
65 | The basic theory is that options specified in the configuration files are | ||
66 | substituted at the beginning of the command line. | ||
67 | |||
68 | The initial use case for this functionality is for hiding passwords, so you do | ||
69 | not have to define sensitive credentials in the Nagios configuration and these | ||
70 | options won't appear in the command line. | ||
71 | |||
72 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||