blob: 7bf3b7f4158ef813858d2e643064e1952fa9e0e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
title: Extra-Opts
parent: Documentation
---
# Extra-Opts
Starting with the 1.4.12 release, most Monitoring Plugins (those written in C)
support reading options from a configuration file. Since version 2.0, this is
enabled by default (but can be disabled at compile-time by specifying the
`--disable-extra-opts` option). Perl plugins using the
[Monitoring::Plugin][module] module have this support since version 0.16.
You can easily know if a plugin supports *Extra-Opts* by checking the `--help`
output for the `--extra-opts` option. Once compiled in, the `--extra-opts`
plugin option allows reading extra options from a config file. The syntax for
the command is:
--extra-opts=[section][@file]
Some examples:
* Read `special_opts` section of default config file:
$ ./check_stuff --extra-opts=special_opts
* Read `special_opts` section of `/etc/myconfig.ini`:
$ ./check_stuff --extra-opts=special_opts@/etc/myconfig.ini
* Read `check_stuff` section of `/etc/myconfig.ini`:
$ ./check_stuff --extra-opts=@/etc/myconfig.ini
* Read `check_stuff` section of default config file and use additional
arguments along with the other specified arguments (*Extra-Opts* arguments
are always processed first no matter where `--extra-opts` appears on the
command line):
$ ./check_stuff --extra-opts -jk --some-other-opt
The default nagios plugins file is used if no explicit filename is given. The
current standard locations checked are:
* `/usr/local/etc/monitoring-plugins/monitoring-plugins.ini`
* `/usr/local/etc/monitoring-plugins.ini`
* `/etc/monitoring-plugins/monitoring-plugins.ini`
* `/etc/monitoring-plugins.ini`
To use a custom location, set the `MP_CONFIG_FILE` environment variable to the
desired path name.
To specify an option without parameter, you can use a key without value, but
the equal sign must remain, for example:
allow-regex=
Also note that repeated keys are allowed within sections just like you can
repeat arguments on the command line.
The basic theory is that options specified in the configuration files are
substituted at the beginning of the command line.
The initial use case for this functionality is for hiding passwords, so you do
not have to define sensitive credentials in the Nagios configuration and these
options won't appear in the command line.
[module]: http://search.cpan.org/dist/Monitoring-Plugin/ "Monitoring::Plugin"
<!--% # vim:set filetype=markdown textwidth=78 joinspaces expandtab: # %-->
|