The check_multi plugin is configured by a simple NRPE stylish ASCII config file.
Format
<keyword> [ <tag> ] = <content>
Elements
The command definition specifies the list of child plugin calls which should be executed by check_multi as parent. Format
command [ <tag> ] = <plugin command line>
Elements
A–Za-z0–9_:/usr/local/nagios/libexec or can be specified on the check_multi command-line using the –libexec-switch.command [ tag::plugin ].
First of all: For the default function of check_multi the state definition feature is not needed
.
The state definition specifies how the results of the child plugin calls should be evaluated. The standard or builtin evaluation looks for any non OK state and returns the state with the highest severity.
The evaluation order is: OK → UNKNOWN → WARNING → CRITICAL.
Format
state [ <OK|UNKNOWN|WARNING|CRITICAL> ] = <expression>
Elements
(disk_root == CRITICAL || disk_opt == CRITICAL).count(warning). Examples
state [ OK ] = 1 state [ UNKNOWN ] = COUNT(UNKNOWN) > 0 state [ WARNING ] = COUNT(WARNING) > 0 state [ CRITICAL ] = COUNT(CRITICAL) > 0
state [ UNKNOWN ] = (1==0) state [ WARNING ] = (1==0) state [ CRITICAL ] = COUNT(CRITICAL) > 0
state [ WARNING ] = COUNT(WARNING) > 0 || COUNT(CRITICAL) > 0 state [ CRITICAL ] = COUNT(CRITICAL) > 1
Config file vs. command line
All states can also be specified on the command line with options -o/-u/-w/-c <state expression>. The precedence in the state evaluation is
Eval is a powerful means to gather information from any source and create flexible plugin configurations.
Format
eval [ <tag> ] = <perl expression>
eeval [ <tag> ] = <perl expression>
Elements
Return code
A eeval statement is a small perl script, and you can set the RC like in other perl scripts via the $? variable.
Nevertheless it is a little bit special: you have to set the RC first and then, in the last statement, define the output of the eeval statement. Look into the following example to understand this:[code perl]eeval [ RC_CRITICAL_output_xyz ] =
# the RC has to be shifted to the high byte of $? $? = $CRITICAL << 8; # the output itself is the return value (well, that's not quite intuitive ;)) return "xyz";[/code]
Examples Examples for eval and eeval can be seen here.
Format
statusdat [ <tag> ] = <host>:<service>
Elements
Note: the status.dat is normally taken from <nagiosdir>/var/status.dat. If you want to specify another path, do it like this:
check_multi -s status_dat=</path/to/status.dat>
Enhancement since 0.20: you can specify wildcards now. E.g.:
statusdat [ web ] = srv*:http
Let's assume that you have three webservers, called h1, h2 and h3, and each of them has a service httpd.
check_multi now expands the child check web to three webservices as follows:
statusdat [ web_h1_httpd ] = h1:httpd statusdat [ web_h2_httpd ] = h2:httpd statusdat [ web_h3_httpd ] = h3:httpd
The new tags are built like this:<tag>_<host>_<service>.
You can also specify services with wild cards.
Question at the end: what will happen, if you specify the following?
statusdat [ all ] = *:*
Yes: all services in your status.dat will be combined within one check_multi call…
This will most likely break your Nagios buffer sizes and it's not really reasonable
. But it shows how this expansion can work.