The check_multi plugin is configured by a simple NRPE stylish ASCII config file.
Format
<keyword> [ <tag> ] = <content>
Elements
With the attribute command you can specify global variables and child check specific settings.
Format
attribute [ <global variable> ] = <global variable value>
attribute [ <tag>::<variable> ] = <child check value>
Elements
Examples
command [ tmp_dir_permissions ] = ls -ld /tmp attribute [ tmp_dir_permissions::critical ] = "$tmp_dir_permissions$" !~ /^drwxrwxrwt/
attribute [ extinfo_in_status ] = 1
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 ]
. 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.
The info command is the door to add information to check_multi.
If you did it with dummy command / echo or dummy eval commands, the disadvantage was that every command bears its own status. And documentation should not show any status.
There are multiple forms of info commands:
info [ tag::pre[_<state> ] = this text comes before a plugin output
info [ tag::post[_<state> ] = and this text comes after the plugin output\nnewlines are allowed
Format
Command | Position | Only if state is |
---|---|---|
info [ TAG::pre ] | before plugin output | one of all states |
info [ TAG::pre_ok ] | before plugin output | OK |
info [ TAG::pre_warning ] | before plugin output | WARNING |
info [ TAG::pre_critical ] | before plugin output | CRITICAL |
info [ TAG::post_unknown ] | before plugin output | UNKNOWN |
info [ TAG::post ] | after plugin output | one of all states |
info [ TAG::post_ok ] | after plugin output | OK |
info [ TAG::post_warning ] | after plugin output | WARNING |
info [ TAG::post_critical ] | after plugin output | CRITICAL |
info [ TAG::post_unknown ] | after plugin output | UNKNOWN |
Details
Format
livestatus [ <tag> ] = <host>:<service>
livestatus [ <tag> ] = <host>
Elements
Note: Additional variables
check_multi -s livestatus=</path/to/livestatus-socket>
Multiple Hosts / Services:
If you want to specify more hosts / services, use regular expressions, which are perl like enclosed in '/'
On the other hand: if you don't use slashes, the expression is taken literally.
/host[289]/ e.g. means host2, host8 and host9, while host123 just means host123.
Another Example:
livestatus [ web ] = /srv.*/:httpd
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:
livestatus [ web_h1_httpd ] = h1:httpd livestatus [ web_h2_httpd ] = h2:httpd livestatus [ web_h3_httpd ] = h3:httpd
The new tags are built like this:<tag>_<host>_<service>
.
You can also specify services with regular expressions.
Question at the end: what will happen, if you specify the following?
livestatus [ all ] = /.*/:/.*/
Yes: all services in your installation 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.
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
Format
statusdat [ <tag> ] = <host>:<service>
(and since 2010/06/04)
statusdat [ <tag> ] = <host>
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>
Multiple Hosts / Services:
If you want to specify more hosts / services, use regular expressions, which are perl like enclosed in '/'
On the other hand: if you don't use slashes, the expression is taken literally.
/host[289]/ e.g. means host2, host8 and host9, while host123 just means host123.
Another Example:
statusdat [ web ] = /srv.*/:httpd
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 regular expressions.
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.