Zabbix Documentation 3.0

3.04.04.45.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

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 [2014/09/30 12:54]
127.0.0.1 external edit
manual:config:items:itemtypes:calculated [2018/08/09 06:56] (current)
martins-v autonumbering removal
Line 1: Line 1:
-==== - #7 Calculated items ====+==== 7 Calculated items ====
  
 === - Overview === === - Overview ===
Line 23: Line 23:
  
 ^ARGUMENT^DEFINITION^ ^ARGUMENT^DEFINITION^
-|**func** ​        |One of the [[manual:​appendix:​triggers:​functions|functions supported in trigger expressions]]: last, min, max, avg, count, etc|+|**func** ​        |One of the [[manual:​appendix:​triggers:​functions|functions]] supported in trigger expressions:​ last, min, max, avg, count, etc|
 |**key** ​    |The key of another item whose data you want to use. It may be defined as **key** or **hostname:​key**.\\ //Note:// Putting the whole key in double quotes ("​..."​) is strongly recommended to avoid incorrect parsing because of spaces or commas within the key.\\ If there are also quoted parameters within the key, those double quotes must be escaped by using the backslash (\). See **Example 5** below.| |**key** ​    |The key of another item whose data you want to use. It may be defined as **key** or **hostname:​key**.\\ //Note:// Putting the whole key in double quotes ("​..."​) is strongly recommended to avoid incorrect parsing because of spaces or commas within the key.\\ If there are also quoted parameters within the key, those double quotes must be escaped by using the backslash (\). See **Example 5** below.|
-|**parameter(s)** |Any additional parameters that may be required.|+|**parameter(s)** |Function parameter(s),​ if required.|
  
 <note tip>All items that are referenced from 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.</​note>​ <note tip>All items that are referenced from 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.</​note>​
  
-<note important>​[[manual:​config:​macros:​usermacros|User macros]] in the formula will be expanded if used to reference a parameter or a constant. User macros will NOT be expanded if used to reference ​a function, host name, item key or operator.</​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>​
  
-A more complex formula may use a combination of functions, operators and brackets. You can use all functions and 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.
  
-Supported characters for function:+Unlike trigger expressions,​ Zabbix processes calculated items according to the item update interval, not upon receiving ​new value.
  
-  ​a..zA..Z0..9_ +<​note>​If the calculation result is float value it will be trimmed ​to an integer if the calculated ​item type of information is //Numeric (unsigned)//​.</​note>​
- +
-Supported characters for a hostname: +
- +
-  a..zA..Z0..9 ._- +
- +
-Supported characters for a key: +
- +
-  a..zA..Z0..9.,​_ +
- +
-Unlike trigger expressions,​ Zabbix processes calculated items according ​to the item update interval, not upon receiving a new value.+
  
 A calculated item may become unsupported in several cases: A calculated item may become unsupported in several cases:
Line 54: Line 44:
   - incorrect syntax used   - incorrect syntax used
  
-<​note>​Support for calculated items was introduced in Zabbix 1.8.1</​note>​+Support for calculated items was introduced in Zabbix 1.8.1.
  
 === - Usage examples === === - Usage examples ===
Line 62: Line 52:
  
 Use of function **last**: ​ Use of function **last**: ​
-  100*last("​vfs.fs.size[/,​free]"​,0)/​last("​vfs.fs.size[/,​total]"​,0)+  100*last("​vfs.fs.size[/,​free]"​)/​last("​vfs.fs.size[/,​total]"​)
  
 Zabbix will take the latest values for free and total disk spaces and calculate percentage according to the given formula. Zabbix will take the latest values for free and total disk spaces and calculate percentage according to the given formula.
Line 72: Line 62:
   avg("​Zabbix Server:​zabbix[wcache,​values]",​600)   avg("​Zabbix Server:​zabbix[wcache,​values]",​600)
  
-Note that extensive use of calculated items with long time periods may affect performance of the Zabbix ​Server.+Note that extensive use of calculated items with long time periods may affect performance of Zabbix ​server.
  
 == Example 3 == == Example 3 ==
Line 78: Line 68:
  
 Sum of two functions: Sum of two functions:
-  last("​net.if.in[eth0,​bytes]"​,0)+last("​net.if.out[eth0,​bytes]"​,0)+  last("​net.if.in[eth0,​bytes]"​)+last("​net.if.out[eth0,​bytes]"​)
  
 == Example 4 == == Example 4 ==
Line 84: Line 74:
  
 More complex expression: More complex expression:
-  100*last("​net.if.in[eth0,​bytes]"​,0)/​(last("​net.if.in[eth0,​bytes]"​,0)+last("​net.if.out[eth0,​bytes]"​,0))+  100*last("​net.if.in[eth0,​bytes]"​)/​(last("​net.if.in[eth0,​bytes]"​)+last("​net.if.out[eth0,​bytes]"​))
  
 == Example 5 == == Example 5 ==
Line 90: Line 80:
  
 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\",​\"​0\"​]"​,0) / last("​grpsum[\"​video\",​\"​nginx_stat.sh[active]\",​\"​last\",​\"​0\"​]"​,0+  last("​grpsum[\"​video\",​\"​net.if.out[eth0,​bytes]\",​\"​last\"​]"​) / last("​grpsum[\"​video\",​\"​nginx_stat.sh[active]\",​\"​last\"​]"​) ​