Expressions

Use expressions for the filter, warning, critical and ok arguments.

Syntax

The basic syntax is <attribute> <operator> <value>. See the operator list for the allowed operators and their meanings.

Each check plugin documents its available attributes.

For example:

filter="status = 'started'"

critical="count >= 1"

Logical Operators

Use logical operators and brackets to combine expressions.

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

These additional operators provide backward compatibility:

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

Date Keywords

For date or timestamp attributes, use these keywords 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)

To use UTC instead of local time, add :utc to a keyword. For example, use today:utc.