Expressions

Expressions are used for the filter, warning, critical and ok arguments.

Syntax

The basic syntax is <attribute> <operator> <value>. For a list and explanation of allowed operators see the operator list.

The list of possible attributes is documented along with each check plugin.

ex.:

filter="status = 'started'"

critical="count >= 1"

Logical Operator

To combine multiple expressions you can use logical operator and brackets.

OperatorAliasDescription
and&&Logical and operator
or||Logical or operator

ex.:

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

Operator

OperatorAlias / Safe expressionTypesDescription
===, is, eqStrings, NumbersMatches on exact equality, ex.: status = 'started'
!=is not, neStrings, NumbersMatches if value is not exactly equal. ex.: 5 != 3
likeStringsMatches if value contains the condition (substring match), ex.: status like "pend"
unlikenot likeStringsMatches if value does not contain the substring, ex.: status unlike "stopped"
ilikeStringsMatches a case insensitive substring, ex.: name ilike "WMI"
not ilikeStringsMatches if a case insensitive substring cannot be found, ex.: name not ilike "WMI"
~regex, regexpStringsPerforms a regular expression match, ex.: status ~ '^pend'
!~not regex, not regexpStringsPerforms a inverse regular expression match, ex.: status !~ 'stop'
~~regexi, regexpiStringsPerforms a case insensitive regular expression match, ex.: status ~~ '^pend'. An alternative way is to use //i as in status ~ /^pend/i
!~~not regexi, not regexpiStringsPerforms a inverse case insensitive regular expression match, ex.: status !~~ 'stop'
<ltNumbersMatches lower than numbers, ex.: usage < 5%
<=le, lteNumbersMatches lower or equal numbers, ex.: usage <= 5%
>gtNumbersMatches greater than numbers, ex.: usage > 5%
>=ge, gteNumbersMatches greater or equal numbers, ex.: usage >= 5%
inStringsMatches if element is in list ex.: status in ('start', 'pending')
not inStringsMatches if element is not in list ex.: status not in ('stopped', 'starting')