Expression macros are useful for formula calculations. They are calculated by expanding all macros inside and evaluating the resulting expression.
Expression macros have a special syntax:
The syntax in EXPRESSION is the same as in trigger expressions (see usage limitations below).
{FUNCTION.VALUE<1-9>} and {FUNCTION.RECOVERY.VALUE<1-9>} macros can be used to reference function values of the trigger expressions and trigger recovery expressions, for example:
{?{FUNCTION.VALUE2} - {FUNCTION.VALUE3}}
{HOST.HOST<1-9>} and {ITEM.KEY<1-9>} macros can be used inside the functions to reference hosts and items, for example:
{?max(/{HOST.HOST}/{ITEM.KEY},3h)}
In the following locations:
only a single function, from the following set: avg
, last
, max
, min
, is allowed as an expression macro, e.g.:
Expressions such as {?last(/host/item1)/last(/host/item2)}
, {?count(/host/item1,5m)}
and {?last(/host/item1)*10}
are incorrect in these locations.
However, in:
complex expressions are allowed, e.g.:
When using expression macros in templates please do not specify the template name but rather use {HOST.HOST<N>}, because template names are not substituted with hosts during linkage. You can also omit host reference altogether for the first host, e.g. {?avg(//item1,1h)}
See also: