You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.
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 {FUNCTION.*} macros to reference function values of trigger expressions/recovery expressions.
  • Use {HOST.HOST<1-9>} and {ITEM.KEY<1-9>} macros to reference hosts and items.
  • 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.
{?{FUNCTION.VALUE2} - {FUNCTION.VALUE3}}
       {?max(/{HOST.HOST}/{ITEM.KEY},3h)}

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