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.

For example:

filter="status = 'started'"

critical="count >= 1"

Logical Operators

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

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

For example:

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

Operators

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

Other Operators

For backwards compatibility there are 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.