Skip to content

Commit

Permalink
add support for extending default filter/warn/crit
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed May 2, 2024
1 parent 4ff9db1 commit 17ad339
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 77 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ This file documents the revision history for the SNClient+ agent.
next:
- update node exporter to 1.8.0
- add native aarch64 (arm64) packages for windows
- add support for extending default filter/warn/crit
- fix missing scripts in inventory

0.23 Mon Apr 15 17:29:53 CEST 2024
Expand Down
27 changes: 27 additions & 0 deletions docs/checks/arguments/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ title: Common Check Arguments
| Option | Description |
| ------------------------------- | ----------- |
| [filter](#filter) | Filter for which items to check |
| [filter+](#filter-1) | Same as filter but extend default filter instead of overwriting it. |
| [warning](#warning) | Threshold when to generate a warning state |
| [warn](#warning) | Short alias for warning |
| [warning+](#warning-1) | Same as warning but extend default warning instead of overwriting it |
| [critical](#critical) | Threshold when to generate a critical state |
| [crit](#critical) | Short alias for critical |
| [critical+](#critical-1) | Same as critical but extend default critical instead of overwriting it |
| [ok](#ok) | Threshold when to generate an ok state |
| [top-syntax](#top-syntax) | Top level syntax. |
| [ok-syntax](#ok-syntax) | Syntax used for ok states. |
Expand All @@ -29,6 +32,14 @@ ex.:

Filter are explained in detail here: [check filter](../filter/)

### Filter+

Extend default filter.

ex.:

'filter+=service = snclient'

### Warning

Filter which sets a threshold when to generate a warning state. If any wanted item
Expand All @@ -41,6 +52,14 @@ ex.:

'warn=load > 90%'

### Warning+

Extend default warning threshold.

ex.:

'warn+=load > 90%'

### Critical

Filter which sets a threshold when to generate a critical state. If any wanted item
Expand All @@ -53,6 +72,14 @@ ex.:

'crit=load > 98%'

### Critical+

Extend default critical threshold.

ex.:

'crit+=load > 90%'

### Ok

Filter which sets a threshold when to generate an ok state. If any wanted item
Expand Down
31 changes: 26 additions & 5 deletions docs/checks/filter/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,40 @@
title: Filter
---

Filter can be uses to select specific objects from a result list. They are also used
in warning, critical or ok thresholds.
Filter can be uses to select specific objects from a result list. So if a filter
is specified, only those elements matching the filter will be considered when
building the final result.

The same syntax is used for warning/critical/ok thresholds, except when used
as threshold, the corresponding status will be set.

## Syntax

All filter follow the syntax `<attribute> <operator> <value>`. For a list and explanation
of allowed operators see [the operator list](#operator).

The list of possible attributes is documented along with the [check plugins](../plugins).
The list of possible attributes is documented along with each [check plugin](../plugins).

ex.:

status = 'started'
filter="status = 'started'"

## Default Filter

Some checks do have default filter, which will be used if no filter is supplied
as check argument.

Default filter are documented along with each [check plugins](../plugins).

The default filter can be unset by using a `none` filter, ex.:

filter="none"

Default filter will be overwritten if a new filter is set.

Existing default filter can be extended by using a `filter+="..."` syntax, ex.:

filter+="status = 'started'"

## Logical Operator

Expand All @@ -27,7 +48,7 @@ To combine multiple filter you can use logical operator and brackets.

ex.:

(status = 'started' or status = 'pending') and usage > 5%
filter="(status = 'started' or status = 'pending') and usage > 5%"

## Operator

Expand Down
Loading

0 comments on commit 17ad339

Please sign in to comment.