Zabbix Documentation 5.2

3.04.05.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.24.4Guidelines

User Tools

Site Tools


manual:config:items:itemtypes:calculated

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:config:items:itemtypes:calculated [2016/10/25 05:44]
martins-v restoring accidentally deleted info
manual:config:items:itemtypes:calculated [2020/06/15 13:18] (current)
martins-v fixing typo
Line 1: Line 1:
-==== - #7 Calculated items ====+==== 7 Calculated items ====
  
-=== Overview ===+=== Overview ===
  
 With calculated items you can create calculations on the basis of other items. With calculated items you can create calculations on the basis of other items.
Line 7: Line 7:
 Thus, calculated items are a way of creating virtual data sources. The values will be periodically calculated based on an arithmetical expression. All calculations are done by the Zabbix server - nothing related to calculated items is performed on Zabbix agents or proxies. Thus, calculated items are a way of creating virtual data sources. The values will be periodically calculated based on an arithmetical expression. All calculations are done by the Zabbix server - nothing related to calculated items is performed on Zabbix agents or proxies.
  
-The resulting data will be stored in the Zabbix database as for any other item - this means storing both history and trend values for fast graph generation. Calculated items may be used in trigger expressions,​ referenced by macros or other entities same as any other item type.+The resulting data will be stored in the Zabbix database as for any other item - this means storing both history and trend values for fast graph generation. Calculated items may be used in trigger expressions,​ referenced by macros or other entities same as any other item type. Comparison to strings is allowed in calculated items.
  
 To use calculated items, choose the item type **Calculated**. ​ To use calculated items, choose the item type **Calculated**. ​
  
-=== Configurable fields ===+=== Configurable fields ===
  
 The **key** is a unique item identifier (per host). You can create any key name using supported symbols. The **key** is a unique item identifier (per host). You can create any key name using supported symbols.
Line 29: Line 29:
 <note tip>All items that are referenced from the calculated item formula must exist and be collecting data (exceptions in [[:​manual/​appendix/​triggers/​functions#​functions_and_unsupported_items|functions and unsupported items]]). Also, if you change the item key of a referenced item, you have to manually update any formulas using that key.</​note>​ <note tip>All items that are referenced from the calculated item formula must exist and be collecting data (exceptions in [[:​manual/​appendix/​triggers/​functions#​functions_and_unsupported_items|functions and unsupported items]]). Also, if you change the item key of a referenced item, you have to manually update any formulas using that key.</​note>​
  
-<note important>​[[manual:​config:​macros:​usermacros|User macros]] in the formula will be expanded if used to reference a function parameter or a constant. User macros will NOT be expanded if referencing a function, host name, item key, item key parameter or operator.</​note>​+<note important>​[[manual:​config:​macros:​user_macros|User macros]] in the formula will be expanded if used to reference a function parameter or a constant. User macros will NOT be expanded if referencing a function, host name, item key, item key parameter or operator.</​note>​
  
 A more complex formula may use a combination of functions, operators and brackets. You can use all functions and [[:​manual/​config/​triggers/​expression#​operators|operators]] supported in trigger expressions. Note that the syntax is slightly different, however logic and operator precedence are exactly the same. A more complex formula may use a combination of functions, operators and brackets. You can use all functions and [[:​manual/​config/​triggers/​expression#​operators|operators]] supported in trigger expressions. Note that the syntax is slightly different, however 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. Unlike trigger expressions,​ Zabbix processes calculated items according to the item update interval, not upon receiving a new value.
 +
 +<​note>​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)//​.</​note>​
  
 A calculated item may become unsupported in several cases: A calculated item may become unsupported in several cases:
Line 47: Line 49:
  
 Support for calculated items was introduced in Zabbix 1.8.1.\\ Starting from Zabbix 3.2 calculated items in some cases may involve unsupported items as described in [[:​manual/​appendix/​triggers/​functions#​functions_and_unsupported_items|functions and unsupported items]], [[:​manual/​config/​triggers/​expression#​expressions_with_unsupported_items_and_unknown_values|Expressions with unsupported items and unknown values]] and [[:​manual/​config/​triggers/​expression#​operators|Operators]]. Support for calculated items was introduced in Zabbix 1.8.1.\\ Starting from Zabbix 3.2 calculated items in some cases may involve unsupported items as described in [[:​manual/​appendix/​triggers/​functions#​functions_and_unsupported_items|functions and unsupported items]], [[:​manual/​config/​triggers/​expression#​expressions_with_unsupported_items_and_unknown_values|Expressions with unsupported items and unknown values]] and [[:​manual/​config/​triggers/​expression#​operators|Operators]].
-=== Usage examples ===+ 
 +=== Usage examples ===
  
 == Example 1 == == Example 1 ==
Line 82: Line 85:
 Take note of how double quotes are escaped within the quoted key: Take note of how double quotes are escaped within the quoted key:
   last("​grpsum[\"​video\",​\"​net.if.out[eth0,​bytes]\",​\"​last\"​]"​) / last("​grpsum[\"​video\",​\"​nginx_stat.sh[active]\",​\"​last\"​]"​) ​   last("​grpsum[\"​video\",​\"​net.if.out[eth0,​bytes]\",​\"​last\"​]"​) / last("​grpsum[\"​video\",​\"​nginx_stat.sh[active]\",​\"​last\"​]"​) ​
 +