summaryrefslogtreecommitdiffstats
path: root/web/content
diff options
context:
space:
mode:
Diffstat (limited to 'web/content')
-rw-r--r--web/content/doc/extra-opts.md72
1 files changed, 72 insertions, 0 deletions
diff --git a/web/content/doc/extra-opts.md b/web/content/doc/extra-opts.md
new file mode 100644
index 0000000..542c199
--- /dev/null
+++ b/web/content/doc/extra-opts.md
@@ -0,0 +1,72 @@
1title: Extra-Opts
2parent: Documentation
3---
4
5# Extra-Opts
6
7Starting with the 1.4.12 release, Nagios C plugins support reading
8configuration options from a configuration file. This needs to be enabled at
9compile-time for now (`--enable-extra-opts`) and will be enabled by default in
10the future. Perl plugins using the Nagios::Plugin module have this support
11since version 0.16.
12
13You can easily know if a plugin supports *extra-opts* by checking the `--help`
14output for the `--extra-opts` option. Once compiled in, the `--extra-opts`
15plugin option allows reading extra options from a config file. The syntax for
16the command is:
17
18 --extra-opts=[section][@file]
19
20Some 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
41The default nagios plugins file is used if no explicit filename is given. The
42current 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
52To use a custom location, set a `NAGIOS_CONFIG_PATH` environment variable to
53the set of directories that should be checked (this is a colon-separated list
54just like `PATH`). The first `plugins.ini` or `nagios-plugins.ini` file found
55in these directories will be used.
56
57To specify an option without parameter, you can use a key without value, but
58the equal sign must remain, for example:
59
60 allow-regex=
61
62Also note that repeated keys are allowed within sections just like you can
63repeat arguments on the command line.
64
65The basic theory is that options specified in the configuration files are
66substituted at the beginning of the command line.
67
68The initial use case for this functionality is for hiding passwords, so you do
69not have to define sensitive credentials in the Nagios configuration and these
70options won't appear in the command line.
71
72<!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %-->