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.

OperatorAliasDescriptionExample
and&&Logical and operatorcount = 0 and state != 1
or||Logical or operatorused > 5 or free < 20

ex.:

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

Operator

OperatorAlias / Safe expressionTypesCase Sens.Description
===, is, eqStrings, NumbersYesMatches on exact equality, ex.: status = 'started'
!=is not, neStrings, NumbersYesMatches if value is not exactly equal. ex.: 5 != 3
likeilikeStringsNoMatches if value contains the condition (case insensitive substring match), ex.: status like "pend"
unlikenot like, not ilikeStringsNoMatches if value does not contain the case insensitive substring, ex.: status unlike "stopped"
slikestrictlikeStringsYesMatches a case sensitive substring, ex.: name slike "WMI"
not slikenot strictlikeStringsYesMatches if a case sensitive substring cannot be found, ex.: name not slike "WMI"
~regex, regexpStringsYesPerforms a regular expression match, ex.: status ~ '^pend'
!~not regex, not regexpStringsYesPerforms a inverse regular expression match, ex.: status !~ 'stop'
~~regexi, regexpiStringsNoPerforms a case insensitive regular expression match, ex.: status ~~ '^pend'. An alternative way is to use //i as in status ~ /^pend/i
!~~not regexi, not regexpiStringsNoPerforms a inverse case insensitive regular expression match, ex.: status !~~ 'stop'
<ltNumbers-Matches lower than numbers, ex.: usage < 5%
<=le, lteNumbers-Matches lower or equal numbers, ex.: usage <= 5%
>gtNumbers-Matches greater than numbers, ex.: usage > 5%
>=ge, gteNumbers-Matches greater or equal numbers, ex.: usage >= 5%
inStringsYesMatches if element is in list ex.: status in ('start', 'pending')
not inStringsYesMatches if element is not in list ex.: status not in ('stopped', 'starting')

Other Operators

For backwards compatibility there more operators available:

OperatorAliasDescriptionExample
''str()String constantexe like str(winlogon.exe)

Date Keywords

For attributes representing a date or timestamp, the following keywords can be used as values:

KeywordDescription
todayStart of the current day (00:00:00 local time)
thisweekStart of the current week (Monday 00:00:00 local time)
thismonthStart of the current month (1st, 00:00:00 local time)
thisyearStart of the current year (Jan 1st, 00:00:00 local time)

Each keyword can be suffixed with :utc to use UTC time instead of local time, e.g., today:utc.