GitHub

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 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:

The default nagios plugins file is used if no explicit filename is given. The current standard locations checked are:

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.