Skip to content

Latest commit

 

History

History
1399 lines (808 loc) · 51.3 KB

CheckHelpers.md

File metadata and controls

1399 lines (808 loc) · 51.3 KB

CheckHelpers

Various helper function to extend other checks.

List of commands

A list of all available queries (check commands)

Command Description
check_always_critical Run another check and regardless of its return code return CRITICAL.
check_always_ok Run another check and regardless of its return code return OK.
check_always_warning Run another check and regardless of its return code return WARNING.
check_and_forward Run a check and forward the result as a passive check.
check_critical Just return CRITICAL (anything passed along will be used as a message).
check_multi Run more then one check and return the worst state.
check_negate Run a check and alter the return status codes according to arguments.
check_ok Just return OK (anything passed along will be used as a message).
check_timeout Run a check and timeout after a given amount of time if the check has not returned.
check_version Just return the NSClient++ version.
check_warning Just return WARNING (anything passed along will be used as a message).
filter_perf Run a check and filter performance data.
render_perf Run a check and render the performance data as output message.
xform_perf Run a check and transform the performance data in various (currently one) way.

List of command aliases

A list of all short hand aliases for queries (check commands)

Command Description
checkalwayscritical Alias for: :query:check_always_critical
checkalwaysok Alias for: :query:check_always_ok
checkalwayswarning Alias for: :query:check_always_warning
checkcritical Alias for: :query:check_critical
checkmultiple Alias for: :query:check_multi
checkok Alias for: :query:check_ok
checkversion Alias for: :query:check_version
checkwarning Alias for: :query:check_warning
negate Alias for: :query:check_negate
timeout Alias for: :query:check_timeout

Queries

A quick reference for all available queries (check commands) in the CheckHelpers module.

check_always_critical

Run another check and regardless of its return code return CRITICAL.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

Run another check and regardless of its return code return OK.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

Run another check and regardless of its return code return WARNING.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

Run a check and forward the result as a passive check.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
target Commands to run (can be used multiple times)
command Commands to run (can be used multiple times)
arguments List of arguments (for wrapped command)
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### target

Description: Commands to run (can be used multiple times)

### command

Description: Commands to run (can be used multiple times)

### arguments

Description: List of arguments (for wrapped command)

Just return CRITICAL (anything passed along will be used as a message).

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
message No message Message to return
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### message

Deafult Value: No message

Description: Message to return

Run more then one check and return the worst state.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
command Commands to run (can be used multiple times)
arguments Deprecated alias for command
separator , Separator between messages
prefix Message prefix
suffix Message suffix
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### command

Description: Commands to run (can be used multiple times)

### arguments

Description: Deprecated alias for command

### separator

Deafult Value: ,

Description: Separator between messages

### prefix

Description: Message prefix

### suffix

Description: Message suffix

Run a check and alter the return status codes according to arguments.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
ok The state to return instead of OK
warning The state to return instead of WARNING
critical The state to return instead of CRITICAL
unknown The state to return instead of UNKNOWN
command Wrapped command to execute
arguments List of arguments (for wrapped command)
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### ok

Description: The state to return instead of OK

### warning

Description: The state to return instead of WARNING

### critical

Description: The state to return instead of CRITICAL

### unknown

Description: The state to return instead of UNKNOWN

### command

Description: Wrapped command to execute

### arguments

Description: List of arguments (for wrapped command)

Just return OK (anything passed along will be used as a message).

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
message No message Message to return
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### message

Deafult Value: No message

Description: Message to return

Run a check and timeout after a given amount of time if the check has not returned.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
timeout The timeout value
command Wrapped command to execute
arguments List of arguments (for wrapped command)
return The return status
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### timeout

Description: The timeout value

### command

Description: Wrapped command to execute

### arguments

Description: List of arguments (for wrapped command)

### return

Description: The return status

Just return the NSClient++ version.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

Just return WARNING (anything passed along will be used as a message).

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
message No message Message to return
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### message

Deafult Value: No message

Description: Message to return

Run a check and filter performance data.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
sort none The sort order to use: none, normal or reversed
limit 0 The maximum number of items to return (0 returns all items)
command Wrapped command to execute
arguments List of arguments (for wrapped command)
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### sort

Deafult Value: none

Description: The sort order to use: none, normal or reversed

### limit

Deafult Value: 0

Description: The maximum number of items to return (0 returns all items)

### command

Description: Wrapped command to execute

### arguments

Description: List of arguments (for wrapped command)

Run a check and render the performance data as output message.

Usage

Option Default Value Description
filter Filter which marks interesting items.
warning Filter which marks items which generates a warning state.
warn Short alias for warning
critical Filter which marks items which generates a critical state.
crit Short alias for critical.
ok Filter which marks items which generates an ok state.
debug N/A Show debugging information in the log
show-all N/A Show details for all matches regardless of status (normally details are only showed for warnings and criticals).
empty-state unknown Return status to use when nothing matched filter.
perf-config Performance data generation configuration
escape-html N/A Escape any < and > characters to prevent HTML encoding
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
top-syntax %(status): %(message) %(list) Top level syntax.
ok-syntax ok syntax.
empty-syntax Empty syntax.
detail-syntax %(key) %(value) %(unit) %(warn) %(crit) %(min) %(max)
Detail level syntax.
perf-syntax %(key) Performance alias syntax.
command Wrapped command to execute
arguments List of arguments (for wrapped command)
remove-perf N/A List of arguments (for wrapped command)
### filter

Description: Filter which marks interesting items. Interesting items are items which will be included in the check. They do not denote warning or critical state instead it defines which items are relevant and you can remove unwanted items. Available options :

Key Value
count Number of items matching the filter. Common option for all checks.
total Total number of items. Common option for all checks.
ok_count Number of items matched the ok criteria. Common option for all checks.
warn_count Number of items matched the warning criteria. Common option for all checks.
crit_count Number of items matched the critical criteria. Common option for all checks.
problem_count Number of items matched either warning or critical criteria. Common option for all checks.
list A list of all items which matched the filter. Common option for all checks.
ok_list A list of all items which matched the ok criteria. Common option for all checks.
warn_list A list of all items which matched the warning criteria. Common option for all checks.
crit_list A list of all items which matched the critical criteria. Common option for all checks.
problem_list A list of all items which matched either the critical or the warning criteria. Common option for all checks.
detail_list A special list with critical, then warning and finally ok. Common option for all checks.
status The returned status (OK/WARN/CRIT/UNKNOWN). Common option for all checks.
crit Major version number
key Major version number
max Major version number
message Major version number
min Major version number
unit Major version number
value Major version number
warn Major version number
### warning

Description: Filter which marks items which generates a warning state. If anything matches this filter the return status will be escalated to warning. Available options :

Key Value
count Number of items matching the filter. Common option for all checks.
total Total number of items. Common option for all checks.
ok_count Number of items matched the ok criteria. Common option for all checks.
warn_count Number of items matched the warning criteria. Common option for all checks.
crit_count Number of items matched the critical criteria. Common option for all checks.
problem_count Number of items matched either warning or critical criteria. Common option for all checks.
list A list of all items which matched the filter. Common option for all checks.
ok_list A list of all items which matched the ok criteria. Common option for all checks.
warn_list A list of all items which matched the warning criteria. Common option for all checks.
crit_list A list of all items which matched the critical criteria. Common option for all checks.
problem_list A list of all items which matched either the critical or the warning criteria. Common option for all checks.
detail_list A special list with critical, then warning and finally ok. Common option for all checks.
status The returned status (OK/WARN/CRIT/UNKNOWN). Common option for all checks.
crit Major version number
key Major version number
max Major version number
message Major version number
min Major version number
unit Major version number
value Major version number
warn Major version number
### warn

Description: Short alias for warning

### critical

Description: Filter which marks items which generates a critical state. If anything matches this filter the return status will be escalated to critical. Available options :

Key Value
count Number of items matching the filter. Common option for all checks.
total Total number of items. Common option for all checks.
ok_count Number of items matched the ok criteria. Common option for all checks.
warn_count Number of items matched the warning criteria. Common option for all checks.
crit_count Number of items matched the critical criteria. Common option for all checks.
problem_count Number of items matched either warning or critical criteria. Common option for all checks.
list A list of all items which matched the filter. Common option for all checks.
ok_list A list of all items which matched the ok criteria. Common option for all checks.
warn_list A list of all items which matched the warning criteria. Common option for all checks.
crit_list A list of all items which matched the critical criteria. Common option for all checks.
problem_list A list of all items which matched either the critical or the warning criteria. Common option for all checks.
detail_list A special list with critical, then warning and finally ok. Common option for all checks.
status The returned status (OK/WARN/CRIT/UNKNOWN). Common option for all checks.
crit Major version number
key Major version number
max Major version number
message Major version number
min Major version number
unit Major version number
value Major version number
warn Major version number
### crit

Description: Short alias for critical.

### ok

Description: Filter which marks items which generates an ok state. If anything matches this any previous state for this item will be reset to ok. Available options :

Key Value
count Number of items matching the filter. Common option for all checks.
total Total number of items. Common option for all checks.
ok_count Number of items matched the ok criteria. Common option for all checks.
warn_count Number of items matched the warning criteria. Common option for all checks.
crit_count Number of items matched the critical criteria. Common option for all checks.
problem_count Number of items matched either warning or critical criteria. Common option for all checks.
list A list of all items which matched the filter. Common option for all checks.
ok_list A list of all items which matched the ok criteria. Common option for all checks.
warn_list A list of all items which matched the warning criteria. Common option for all checks.
crit_list A list of all items which matched the critical criteria. Common option for all checks.
problem_list A list of all items which matched either the critical or the warning criteria. Common option for all checks.
detail_list A special list with critical, then warning and finally ok. Common option for all checks.
status The returned status (OK/WARN/CRIT/UNKNOWN). Common option for all checks.
crit Major version number
key Major version number
max Major version number
message Major version number
min Major version number
unit Major version number
value Major version number
warn Major version number
### debug

Description: Show debugging information in the log

### show-all

Description: Show details for all matches regardless of status (normally details are only showed for warnings and criticals).

### empty-state

Deafult Value: unknown

Description: Return status to use when nothing matched filter. If no filter is specified this will never happen unless the file is empty.

### perf-config

Description: Performance data generation configuration TODO: obj ( key: value; key: value) obj (key:valuer;key:value)

### escape-html

Description: Escape any < and > characters to prevent HTML encoding

### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### top-syntax

Deafult Value: %(status): %(message) %(list)

Description: Top level syntax. Used to format the message to return can include text as well as special keywords which will include information from the checks. To add a keyword to the message you can use two syntaxes either ${keyword} or %(keyword) (there is no difference between them apart from ${} can be difficult to excpae on linux). The available keywords are:

Key Value
count Number of items matching the filter. Common option for all checks.
total Total number of items. Common option for all checks.
ok_count Number of items matched the ok criteria. Common option for all checks.
warn_count Number of items matched the warning criteria. Common option for all checks.
crit_count Number of items matched the critical criteria. Common option for all checks.
problem_count Number of items matched either warning or critical criteria. Common option for all checks.
list A list of all items which matched the filter. Common option for all checks.
ok_list A list of all items which matched the ok criteria. Common option for all checks.
warn_list A list of all items which matched the warning criteria. Common option for all checks.
crit_list A list of all items which matched the critical criteria. Common option for all checks.
problem_list A list of all items which matched either the critical or the warning criteria. Common option for all checks.
detail_list A special list with critical, then warning and finally ok. Common option for all checks.
status The returned status (OK/WARN/CRIT/UNKNOWN). Common option for all checks.
### ok-syntax

Description: ok syntax. DEPRECATED! This is the syntax for when an ok result is returned. This value will not be used if your syntax contains %(list) or %(count).

### empty-syntax

Description: Empty syntax. DEPRECATED! This is the syntax for when nothing matches the filter. Possible values are:

Key Value
count Number of items matching the filter. Common option for all checks.
total Total number of items. Common option for all checks.
ok_count Number of items matched the ok criteria. Common option for all checks.
warn_count Number of items matched the warning criteria. Common option for all checks.
crit_count Number of items matched the critical criteria. Common option for all checks.
problem_count Number of items matched either warning or critical criteria. Common option for all checks.
list A list of all items which matched the filter. Common option for all checks.
ok_list A list of all items which matched the ok criteria. Common option for all checks.
warn_list A list of all items which matched the warning criteria. Common option for all checks.
crit_list A list of all items which matched the critical criteria. Common option for all checks.
problem_list A list of all items which matched either the critical or the warning criteria. Common option for all checks.
detail_list A special list with critical, then warning and finally ok. Common option for all checks.
status The returned status (OK/WARN/CRIT/UNKNOWN). Common option for all checks.
### detail-syntax

Deafult Value: %(key) %(value) %(unit) %(warn) %(crit) %(min) %(max)

Description: Detail level syntax. Used to format each resulting item in the message. %(list) will be replaced with all the items formated by this syntax string in the top-syntax. To add a keyword to the message you can use two syntaxes either ${keyword} or %(keyword) (there is no difference between them apart from ${} can be difficult to excpae on linux). The available keywords are:

Key Value
crit Major version number
key Major version number
max Major version number
message Major version number
min Major version number
unit Major version number
value Major version number
warn Major version number
### perf-syntax

Deafult Value: %(key)

Description: Performance alias syntax. This is the syntax for the base names of the performance data. Possible values are:

Key Value
crit Major version number
key Major version number
max Major version number
message Major version number
min Major version number
unit Major version number
value Major version number
warn Major version number
### command

Description: Wrapped command to execute

### arguments

Description: List of arguments (for wrapped command)

### remove-perf

Description: List of arguments (for wrapped command)

Run a check and transform the performance data in various (currently one) way.

Usage

Option Default Value Description
help N/A Show help screen (this screen)
help-pb N/A Show help screen as a protocol buffer payload
show-default N/A Show default values for a given command
help-short N/A Show help screen (short format).
command Wrapped command to execute
arguments List of arguments (for wrapped command)
mode Transformation mode: extract to fetch data or minmax to add missing min/max
field Field to work with (value, warn, crit, max, min)
replace Replace expression for the alias
### help

Description: Show help screen (this screen)

### help-pb

Description: Show help screen as a protocol buffer payload

### show-default

Description: Show default values for a given command

### help-short

Description: Show help screen (short format).

### command

Description: Wrapped command to execute

### arguments

Description: List of arguments (for wrapped command)

### mode

Description: Transformation mode: extract to fetch data or minmax to add missing min/max

### field

Description: Field to work with (value, warn, crit, max, min)

### replace

Description: Replace expression for the alias