Skip to content

Add check_multi - #451

Draft
lgmu wants to merge 7 commits into
ConSol-Monitoring:mainfrom
lgmu:check-multi
Draft

Add check_multi#451
lgmu wants to merge 7 commits into
ConSol-Monitoring:mainfrom
lgmu:check-multi

Conversation

@lgmu

@lgmu lgmu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

By default 'CheckMulti' is enabled, but you can disable it in the '[/modules]' section of the snclient_local.ini.
You can also set a limit for the number of checks that can be executed in the '[/settings/check/multi]' section
of the snclient_local.ini.

When using the inline mode, you can only use available commands (run 'check_index' to get a full list).

You can also define custom check sections in the config file, for example:
[/settings/check/multi/mycheck]
check_process process=123
check_process process=345

This can be executed with 'check_multi "config=mycheck"'.

It's also possible to use custom scripts in the config section, for example:
[/settings/check/multi/myscript]
/path/to/plugin1
/path/to/plugin2
/path/to/plugin3

This can be executed with 'check_multi "config=myscript"'.

Examples: 

check_multi "check=check_process 'process=firefox'" "check=check_memory 'crit=used_pct gt 80%'"
OK - 2 plugins checked, 2 ok | 'check_process::count'=1;;;0 'check_process::rss'=258686976B;;;0 ...
[ 1] check_process OK - all 1 processes are ok.
[ 2] check_memory OK - physical = 12.22 GiB/16.00 GiB (76.4%), swap = 1.95 GiB/3.00 GiB (65.0%)

You can define warning/critical conditions based on the number of checks in a certain state (see attributes below):

check_multi "check=check_dummy 0 'OK'" "check=check_dummy 1 'WARNING'" "critical=problem_count gt 0"
CRITICAL - 2 plugins checked: 1 ok, 1 warning, 0 critical, 0 unknown
[ 1] check_dummy OK
[ 2] check_dummy WARNING

@lgmu

lgmu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

ToDo:

  • bugfix IF ELSE Conditions in top-syntax
  • add advanced example to docs

check_multi "check=check_dummy 2 'CRITICAL'" "check=check_dummy 3 'UNKNOWN'" "top-syntax={{ IF ok_count gt 0 }}OK - %(ok_count)/%(count) checks are OK {{ ELSE }}CRITICAL - all checks failed{{ END }}"
OK - 0/2 checks are OK
[ 1] check_dummy CRITICAL
[ 2] check_dummy UNKNOWN


res = snc.RunCheck("check_files", []string{"path=./t/checksum.txt", "crit=md5_checksum != 3687C5D7106484CD61CDE867A2A999FA"})
assert.Equalf(t, CheckExitCritical, res.State, "CRITICAL")
assert.Contains(t, string(res.BuildPluginOutput()), "0/1 files")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discuss with @sni why it was 0 in the first place

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is passing without changes on windows for the latest main commit f9a22ac

the file MD5 is 3687C5D7106484CD61CDE867A2A999FA so raising critical is correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea but problem_count is 0, while it should be 1.
CRITICAL is still expected, nothing has changed there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants