-
Notifications
You must be signed in to change notification settings - Fork 19
Add check_multi #451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lgmu
wants to merge
7
commits into
ConSol-Monitoring:main
Choose a base branch
from
lgmu:check-multi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add check_multi #451
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d8c56d5
add check_multi
lgmu 15e36f1
fix test, problem_count should be 1 here
lgmu c8b007d
fix windows tests
lgmu db3ec6c
Merge branch 'main' into check-multi
lgmu 4fc5bc2
fix DOC_COMMANDS
lgmu 461bc15
update docs
lgmu 6542be3
improve docs
lgmu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| --- | ||
| title: multi | ||
| --- | ||
|
|
||
| ## check_multi | ||
|
|
||
| Runs multiple checks and aggregates their status, output and performance data. | ||
|
|
||
| By default 'CheckMulti' is enabled, but you can disable it in the '[/modules]' section of the snclient_local.ini. | ||
| You can also set 'max checks' in the '[/settings/check/multi]' section of the snclient_local.ini, which limits | ||
| the number of checks that can be configured. | ||
|
|
||
| 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](#examples) | ||
| - [Argument Defaults](#argument-defaults) | ||
| - [Attributes](#attributes) | ||
|
|
||
| ## Implementation | ||
|
|
||
| | Windows | Linux | FreeBSD | MacOSX | | ||
| |:------------------:|:------------------:|:------------------:|:------------------:| | ||
| | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Default Check | ||
|
|
||
| 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 | ||
|
|
||
| ### Example using NRPE and Naemon | ||
|
|
||
| Naemon Config | ||
|
|
||
| define command{ | ||
| command_name check_nrpe | ||
| command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -n -c $ARG1$ -a $ARG2$ | ||
| } | ||
|
|
||
| define service { | ||
| host_name testhost | ||
| service_description check_multi | ||
| use generic-service | ||
| check_command check_nrpe!check_multi! | ||
| } | ||
|
|
||
| ## Argument Defaults | ||
|
|
||
| | Argument | Default Value | | ||
| | ------------- | ----------------------------------------------------------------------------------------------------- | | ||
| | warning | warning_count > 0 | | ||
| | critical | critical_count > 0 \|\| 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 | %(status) - %(count) plugins checked, %(ok_count) ok | | ||
| | detail-syntax | [%(status)] %(name): %(output) | | ||
|
|
||
| ## Check Specific Arguments | ||
|
|
||
| | Argument | Description | | ||
| | -------- | ------------------------------------------------------------------------ | | ||
| | check | Check command to execute (can be specified multiple times) | | ||
| | config | Config section name under [/settings/check/multi/< section >] to execute | | ||
|
|
||
| ## Attributes | ||
|
|
||
| ### Filter Keywords | ||
|
|
||
| these can be used 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 | | ||
| | 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 | Output of the check | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
0in the first placeThere was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea but
problem_countis0, while it should be1.CRITICAL is still expected, nothing has changed there