check_multi
Runs multiple checks and combines their status, output and performance data.
CheckMulti is enabled by default. To disable it, use the [/modules] section of snclient_local.ini.
To limit the number of configured checks, set max checks in the [/settings/check/multi] section of snclient_local.ini.
In inline mode, you can use only available commands. Run check_index for the full list.
You can also define custom check sections in the configuration file. For example:
[/settings/check/multi/mycheck]
var[PROCESS] = 123
command[alias1] = check_process process=$PROCESS$
command[alias2] = check_process process=345
Run this check with check_multi “config=mycheck”.
Use check_multi “config=mycheck” “var[PROCESS]=456” to override a variable’s default value.
Variable names are case-sensitive. SNClient replaces every occurrence of a declared variable. Undeclared placeholders stay unchanged.
Values must not contain shell metacharacters or control characters. Quote placeholders to preserve spaces.
Variables without defaults must be declared as required (comma-separated):
[/settings/check/multi/required]
required vars = MESSAGE
command[message] = check_dummy 0 '$MESSAGE$'
Run this with check_multi “config=required” “var[MESSAGE]=Service is healthy”.
A required variable must have a default unless you supply its value explicitly. An empty value counts as supplied.
You can also use custom scripts in the configuration section. For example:
[/settings/check/multi/myscript]
command[alias1] = /path/to/plugin1
command[alias2] = /path/to/plugin2
command[alias3] = /path/to/plugin3
Run these scripts with check_multi “config=myscript”.
Implementation
| Windows | Linux | FreeBSD | macOS |
|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ |
Argument Defaults
| Argument | Default Value |
|---|---|
| warning | warning_count > 0 |
| critical | critical_count > 0 |
| unknown | unknown_count > 0 |
| empty-state | 3 (UNKNOWN) |
| empty-syntax | %(status) - no checks executed |
| top-syntax | %(status) - %(count) plugins checked: %(ok_count) ok, %(warning_count) warning, %(critical_count) critical, %(unknown_count) unknown - %(problem_list) |
| ok-syntax | {{ if problem_count gt 0 }}%(status) - %(count) plugins checked: %(ok_count) ok, %(warning_count) warning, %(critical_count) critical, %(unknown_count) unknown - %(problem_list){{ ELSE }}%(status) - %(count) plugins checked, %(ok_count) ok{{ END }} |
| detail-syntax | %(name): %(shortoutput) |
| long-detail-syntax | [%(name)] %(output) |
Check Specific Arguments
| Argument | Description |
|---|---|
| command | Check command to execute. Requires a unique tag, for example command[tag]=… |
| config | Configuration section to execute under [/settings/check/multi/< section >] |
| var | Override a configuration variable. For example, var[KEY]=VALUE replaces $KEY$ in configured commands |
Attributes
Filter Keywords
Use these attributes in filters and thresholds, along with the default attributes:
| Attribute | Description |
|---|---|
| count | Total number of checks executed |
| ok_count | Number of checks in OK state |
| warning_count | Number of checks in WARNING state |
| critical_count | Number of checks in CRITICAL state |
| unknown_count | Number of checks in UNKNOWN state |
| problem_count | Number of checks in non-OK state |
| name | Name/tag of the check |
| tag | Alias for name |
| command | Command executed |
| state | Exit code of the check (0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN) |
| status | Status text of the check (OK, WARNING, CRITICAL, UNKNOWN) |
| output | Check output |
| shortoutput | First line of the check output |
Examples
Default Check
check_multi "command[check_process]=check_process 'process=firefox'" "command[check_memory]=check_memory 'type=physical' 'crit=used_pct gt 80%'"
OK - 2 plugins checked, 2 ok |'check_process::count'=1;;;0 ... 'check_memory::physical %'=78.7%;;;0;100
[check_process] OK - all 1 processes are ok.
[check_memory] OK - physical = 12.59 GiB/16.00 GiB (78.7%)
Define 'warning' and 'critical' conditions from the number of checks in a given state. See the attributes above:
check_multi "command[check_dummy1]=check_dummy 0 'OK - check works'" "command[check_dummy2]=check_dummy 1 'WARNING - problem found'" "critical=problem_count gt 0"
CRITICAL - 2 plugins checked: 1 ok, 1 warning, 0 critical, 0 unknown - warning(check_dummy2: WARNING - problem found)
[check_dummy1] OK - check works
[check_dummy2] WARNING - problem found
Override 'top-syntax' and use IF ELSE statements to change the output based on the results:
check_multi "command[check_dummy1]=check_dummy 0 'OK'" "command[check_dummy2]=check_dummy 2 'CRITICAL'" \
"top-syntax={{ if ok_count gt 0 }}OK - %(ok_count)/%(count) checks are OK {{ ELSE }}CRITICAL - all checks failed{{ END }}"
OK - 1/2 checks are OK
[check_dummy1] OK
[check_dummy2] CRITICAL
Example using check_snclient and Naemon
Naemon Config
define command{
command_name check_snclient
command_line $USER1$/check_snclient -k -p 'your-password' -u 'https://$HOSTADDRESS$:8443' $ARG1$ $ARG2$
}
define service {
host_name testhost
service_description check_multi
use generic-service
check_command check_snclient!check_multi!"command[check_cpu]=check_cpu" "command[check_memory]=check_memory"
}