With calculated items it is possible to create calculations based on the values of other items.
Calculations may use both:
Thus, calculated items are a way of creating virtual data sources. All calculations are done by Zabbix server only. The values are periodically calculated based on the arithmetical expression used.
The resulting data is stored in the Zabbix database as for any other item; both history and trend values are stored and graphs can be generated.
If the calculation result is a float value it will be trimmed to an integer if the calculated item type of information is Numeric (unsigned).
Calculated items share their syntax with trigger expressions. Comparison to strings is allowed in calculated items. Calculated items may be referenced by macros or other entities same as any other item type.
To use calculated items, choose the item type Calculated.
The key is a unique item identifier (per host). You can create any key name using supported symbols.
Calculation definition should be entered in the Formula field. There is virtually no connection between the formula and the key. The key parameters are not used in the formula in any way.
The syntax of a simple formula is:
|function||One of the supported functions: last, min, max, avg, count, etc|
|host||Host of the item that is used for calculation.
The current host can be omitted (i.e. as in
|key||Key of the item that is used for calculation.|
|parameter(s)||Parameters of the function, if required.|
User macros in the formula will be expanded if used to reference a function parameter, item filter parameter, or a constant. User macros will NOT be expanded if referencing a function, host name, item key, item key parameter or operator.
A more complex formula may use a combination of functions, operators and brackets. You can use all functions and operators supported in trigger expressions. The logic and operator precedence are exactly the same.
Unlike trigger expressions, Zabbix processes calculated items according to the item update interval, not upon receiving a new value.
All items that are referenced by history functions in the calculated item formula must exist and be collecting data. Also, if you change the item key of a referenced item, you have to manually update any formulas using that key.
A calculated item may become unsupported in several cases:
Calculating percentage of free disk space on '/'.
Use of function last:
Zabbix will take the latest values for free and total disk spaces and calculate percentage according to the given formula.
Calculating a 10-minute average of the number of values processed by Zabbix.
Use of function avg:
Note that extensive use of calculated items with long time periods may affect performance of Zabbix server.
Calculating total bandwidth on eth0.
Sum of two functions:
Calculating percentage of incoming traffic.
More complex expression:
See also: Examples of aggregate calculations