Zabbix Documentation 2.4

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


manual:config:triggers:expression

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:triggers:expression [2017/05/15 07:58]
martins-v removing exact listing of functions supporting time_shift
manual:config:triggers:expression [2019/07/08 05:45] (current)
martins-v 'sum' is evaluated starting with the first received value
Line 8: Line 8:
   {<​server>:<​key>​.<​function>​(<​parameter>​)}<​operator><​constant>​   {<​server>:<​key>​.<​function>​(<​parameter>​)}<​operator><​constant>​
  
-=== Functions ===+=== Functions ===
  
 Trigger functions allow to reference the collected values, current time and other factors. Trigger functions allow to reference the collected values, current time and other factors.
Line 14: Line 14:
 A complete list of [[manual:​appendix:​triggers:​functions|supported functions]] is available. A complete list of [[manual:​appendix:​triggers:​functions|supported functions]] is available.
  
-=== Function parameters ===+=== Function parameters ===
  
 Most of numeric functions accept the number of seconds as a parameter. ​ Most of numeric functions accept the number of seconds as a parameter. ​
Line 21: Line 21:
  
 ^FUNCTION CALL^MEANING^ ^FUNCTION CALL^MEANING^
-|**sum(600)** |Sum of all values ​within ​600 seconds| +|**sum(600)** |Sum of all values ​in no more than the latest ​600 seconds| 
-|**sum(#​5)** ​ |Sum of the last 5 values|+|**sum(#​5)** ​ |Sum of all values in no more than the last 5 values|
  
 The function **last** uses a different meaning for values when prefixed with the hash mark - it makes it choose the n-th previous value, so given the values 3, 7, 2, 6, 5 (from most recent to least recent), **last(#​2)** would return //7// and **last(#​5)** would return //5//. The function **last** uses a different meaning for values when prefixed with the hash mark - it makes it choose the n-th previous value, so given the values 3, 7, 2, 6, 5 (from most recent to least recent), **last(#​2)** would return //7// and **last(#​5)** would return //5//.
  
 Several functions support an additional, second ''​time_shift''​ parameter. This parameter allows to reference data from a period of time in the past. For example, **avg(1h,​1d)** will return the average value for an hour one day ago. Several functions support an additional, second ''​time_shift''​ parameter. This parameter allows to reference data from a period of time in the past. For example, **avg(1h,​1d)** will return the average value for an hour one day ago.
- 
-<note tip>​Triggers only evaluate history information. If history is not available (especially relevant for time shift), trend information is not used, thus history must be kept for at least the period trigger functions expect it.</​note>​ 
  
 You can use the supported [[suffixes|unit symbols]] in trigger expressions,​ for example '​5m'​ (minutes) instead of '​300'​ seconds or '​1d'​ (day) instead of '​86400'​ seconds. '​1K'​ will stand for '​1024'​ bytes. You can use the supported [[suffixes|unit symbols]] in trigger expressions,​ for example '​5m'​ (minutes) instead of '​300'​ seconds or '​1d'​ (day) instead of '​86400'​ seconds. '​1K'​ will stand for '​1024'​ bytes.
  
-=== Operators ===+=== Operators ===
  
 The following operators are supported for triggers **(in descending priority of execution)**:​ The following operators are supported for triggers **(in descending priority of execution)**:​
Line 62: Line 60:
   * **or** shall yield '​1'​ if either of its operands compare unequal to '​0';​ otherwise, it yields '​0'; ​   * **or** shall yield '​1'​ if either of its operands compare unequal to '​0';​ otherwise, it yields '​0'; ​
   * The result of the logical negation operator **not** is '​0'​ if the value of its operand compares unequal to '​0';​ '​1'​ if the value of its operand compares equal to '​0'​.   * The result of the logical negation operator **not** is '​0'​ if the value of its operand compares unequal to '​0';​ '​1'​ if the value of its operand compares equal to '​0'​.
-=== Examples of triggers ===+ 
 +=== Value caching === 
 + 
 +Values required for trigger evaluation are cached by Zabbix server. Because of this trigger evaluation causes a higher database load for some time after the server restarts. The value cache is not cleared when item history values are removed (either manually or by housekeeper),​ so the server will use the cached values until they are older than the time periods defined in trigger functions or server is restarted. 
 + 
 +=== Examples of triggers ===
  
 == Example 1 == == Example 1 ==
Line 116: Line 119:
 Use of function nodata(): Use of function nodata():
   {zabbix.zabbix.com:​tick.nodata(3m)}=1   {zabbix.zabbix.com:​tick.nodata(3m)}=1
-'​tick'​ must have type '​Zabbix trapper'​. In order to make this trigger ​workitem '​tick'​ must be defined. The host should periodically send data for this parameter ​using zabbix_sender. If no data is received within 180 seconds, the trigger value becomes PROBLEM.+ 
 +To make use of this trigger, '​tick'​ must be defined ​as a Zabbix [[:​manual/​config/​items/​itemtypes/​trapper|trapper]] item. The host should periodically send data for this item using zabbix_sender. If no data is received within 180 seconds, the trigger value becomes PROBLEM
 + 
 +//Note// that '​nodata'​ can be used for any item type.
  
 == Example 9 == == Example 9 ==
Line 124: Line 130:
   {zabbix:​system.cpu.load[all,​avg1].min(5m)}>​2 and {zabbix:​system.cpu.load[all,​avg1].time()}>​000000 and {zabbix:​system.cpu.load[all,​avg1].time()}<​060000   {zabbix:​system.cpu.load[all,​avg1].min(5m)}>​2 and {zabbix:​system.cpu.load[all,​avg1].time()}>​000000 and {zabbix:​system.cpu.load[all,​avg1].time()}<​060000
 The trigger may change its status to true, only at night (00:​00-06:​00) time. The trigger may change its status to true, only at night (00:​00-06:​00) time.
- 
  
 == Example 10 == == Example 10 ==
Line 157: Line 162:
 The trigger will fire if at least two of the triggers in the expression are over 5. The trigger will fire if at least two of the triggers in the expression are over 5.
  
-=== Hysteresis ===+=== Hysteresis ===
  
 Sometimes a trigger must have different conditions for different states. For example, we would like to define a trigger which would become PROBLEM when server room temperature is higher than 20C while it should stay in the state until temperature will not become lower than 15C. Sometimes a trigger must have different conditions for different states. For example, we would like to define a trigger which would become PROBLEM when server room temperature is higher than 20C while it should stay in the state until temperature will not become lower than 15C.