Table of Contents

6 Expression macros

Overview

Expression macros let you perform calculations in fields.

Their value is calculated by first resolving any inner macros and then evaluating the resulting expression.

Syntax:

{?EXPRESSION}

EXPRESSION uses the same syntax and supports the same functions as trigger expressions.

Example:

{?trendavg(/host/item1,1M:now/M)/trendavg(/host/item1,1M:now/M-1y)*100}

For supported locations, see Supported macros.

Notes on usage:

  • Use {HOST.HOST<1-9>} and {ITEM.KEY<1-9>} macros to reference hosts and items—for example, {?max(/{HOST.HOST}/{ITEM.KEY},3h)}
  • In templates, use {HOST.HOST<1-9>} macros or omit the host altogether for the first host—for example, {?avg(//item1,1h)}—instead of template names, as template names are not replaced with host names during template linking.

See also Trigger expression examples for an example of using an expression macro in an event name.