All functions listed here are supported in:
The functions are listed without additional information. Click on the function to see the full details.
| Function | Description |
|---|---|
| change | The amount of difference between the previous and latest value. |
| changecount | The number of changes between adjacent values within the defined evaluation period. |
| count | The number of values within the defined evaluation period. |
| countunique | The number of unique values within the defined evaluation period. |
| find | Find a value match within the defined evaluation period. |
| first | The first (the oldest) value within the defined evaluation period. |
| fuzzytime | Check how much the passive agent time differs from the Zabbix server/proxy time. |
| last | The most recent value. |
| logeventid | Check if the event ID of the last log entry matches a regular expression. |
| logseverity | The log severity of the last log entry. |
| logsource | Check if log source of the last log entry matches a regular expression. |
| monodec | Check if there has been a monotonous decrease in values. |
| monoinc | Check if there has been a monotonous increase in values. |
| nodata | Check for no data received. |
| percentile | The P-th percentile of a period, where P (percentage) is specified by the third parameter. |
| rate | The per-second average rate of the increase in a monotonically increasing counter within the defined time period. |
/host/key is a common mandatory first parameter for the functions referencing the host item history(sec|#num)<:time shift> is a common second parameter for the functions referencing the host item history, where:
Some general notes on function parameters:
< >/host/key and (sec|#num)<:time shift> parameters must never be quotedThe amount of difference between the previous and latest value.
Supported value types: Float, Integer, String, Text, Log.
For strings returns: 0 - values are equal; 1 - values differ.
Parameters: see common parameters.
Comments:
+4-2-2.5.Examples:
change(/host/system.uptime)<0 #system uptime change has been negative since the last value (indicating a reboot)
change(/host/system.cpu.load[all,avg1])>2 #CPU load (for one minute) has jumped by more than 2 since the last value
change(/host/vfs.fs.size[/,free])<-1G #free disk space has dropped by more than 1 GB between checksThe number of changes between adjacent values within the defined evaluation period.
Supported value types: Float, Integer, String, Text, Log.
Parameters:
For non-numeric value types, the mode parameter is ignored.
Examples:
changecount(/host/icmpping,10m)>5 #ping status has changed more than 5 times in 10 minutes
changecount(/host/vfs.file.contents["/sys/class/net/eth0/operstate"],1h)>5 #operational state of eth0 has changed more than 5 times in an hour
changecount(/host/proc.num[httpd],15m)>10 #the number of httpd processes has changed more than 10 times in 15 minutes
changecount(/host/key,#10,"inc") #the number of value increases (relative to the adjacent value) among the last 10 values
changecount(/host/key,24h,"dec") #the number of value decreases (relative to the adjacent value) for the last 24 hours until nowThe number of values within the defined evaluation period.
Supported value types: Float, Integer, String, Text, Log.
Parameters:
operators:patternpatternComments:
pattern parameter can be specified as two numbers, separated by '/': number_to_compare_with/mask. count() calculates "bitwise AND" from the value and the mask and compares the result to number_to_compare_with. If the result of "bitwise AND" is equal to number_to_compare_with, the value is counted.pattern parameter can be an ordinary or global (starting with '@') regular expression. In case of global regular expressions case sensitivity is inherited from global regular expression settings. For the purpose of regexp matching, float values will always be represented with 4 decimal digits after '.'. Also note that for large numbers difference in decimal (stored in database) and binary (used by Zabbix server) representation may affect the 4th decimal digit.Examples:
count(/host/icmpping,30m,,"0")>5 #ping has failed more than 5 times in 30 minutes
count(/host/key,10m,"like","error") #the number of values for the last 10 minutes until now that contain 'error'
count(/host/key,10m,,12) #the number of values for the last 10 minutes until now that equal '12'
count(/host/key,10m,"gt",12) #the number of values for the last 10 minutes until now that are over '12'
count(/host/key,#10,"gt",12) #the number of values within the last 10 values until now that are over '12'
count(/host/key,10m:now-1d,"gt",12) #the number of values between 24 hours and 10 minutes and 24 hours ago from now that were over '12'
count(/host/key,10m,"bitand","6/7") #the number of values for the last 10 minutes until now having '110' (in binary) in the 3 least significant bits
count(/host/key,10m:now-1d) #the number of values between 24 hours and 10 minutes and 24 hours ago from nowThe number of unique values within the defined evaluation period.
Supported value types: Float, Integer, String, Text, Log.
Parameters:
operators:patternpatternComments:
pattern parameter can be specified as two numbers, separated by '/': number_to_compare_with/mask. countunique() calculates "bitwise AND" from the value and the mask and compares the result to number_to_compare_with. If the result of "bitwise AND" is equal to number_to_compare_with, the value is counted.pattern parameter can be an ordinary or global (starting with '@') regular expression. In case of global regular expressions case sensitivity is inherited from global regular expression settings. For the purpose of regexp matching, float values will always be represented with 4 decimal digits after '.'. Also note that for large numbers difference in decimal (stored in database) and binary (used by Zabbix server) representation may affect the 4th decimal digit.Examples:
countunique(/host/key,10m) #the number of unique values for the last 10 minutes until now
countunique(/host/key,10m,"like","error") #the number of unique values for the last 10 minutes until now that contain 'error'
countunique(/host/key,10m,,12) #the number of unique values for the last 10 minutes until now that equal '12'
countunique(/host/key,10m,"gt",12) #the number of unique values for the last 10 minutes until now that are over '12'
countunique(/host/key,#10,"gt",12) #the number of unique values within the last 10 values until now that are over '12'
countunique(/host/key,10m:now-1d,"gt",12) #the number of unique values between 24 hours and 10 minutes and 24 hours ago from now that were over '12'
countunique(/host/key,10m,"bitand","6/7") #the number of unique values for the last 10 minutes until now having '110' (in binary) in the 3 least significant bits
countunique(/host/key,10m:now-1d) #the number of unique values between 24 hours and 10 minutes and 24 hours ago from nowFind a value match within the defined evaluation period.
Supported value types: Float, Integer, String, Text, Log.
Returns: 1 - found; 0 - otherwise.
Parameters:
operators:pattern (case-sensitive)patternpatternoperator is regexp, iregexpComments:
pattern parameter can be an ordinary or global (starting with '@') regular expression. In case of global regular expressions case sensitivity is inherited from the global regular expression settings.Examples:
find(/host/key,10m,"like","error") #find a value that contains 'error' within the last 10 minutes until now
find(/host/agent.version,,"like","beta")=1 #Zabbix agent has beta version, must be upgraded
find(/host/log[/var/log/nginx/access.log],,"regexp"," 500 ")=1 #internal web server error has been foundThe first (the oldest) value within the defined evaluation period.
Supported value types: Float, Integer, String, Text, Log.
Parameters:
See also last().
Example:
Check how much the passive agent time differs from the Zabbix server/proxy time.
Supported value types: Float, Integer.
Returns: 1 - difference between the passive item value (as timestamp) and Zabbix server/proxy timestamp (the clock of value collection) is less than or equal to sec seconds; 0 - otherwise.
Parameters:
Comments:
vfs.file.time[/path/file,modify] key to check that the file did not get updates for long time.fuzzytime(/Host/system.localtime,60s)=0 or last(/Host/trap)<>0.Examples:
fuzzytime(/host/system.localtime,5m)=0 #client local time differs from Zabbix server/proxy time by more than 5 minutes
fuzzytime(/host/system.localtime,5m)=0 and nodata(/host/system.localtime,10m)=0 #client local time differs from Zabbix server/proxy time by more than 5 minutes (while making sure the item has not stopped reporting data)The most recent value.
Supported value types: Float, Integer, String, Text, Log.
Parameters:
Comments:
last(/host/key) is always equal to last(/host/key,#1); last(/host/key,#3) - the third most recent value (not three latest values).Examples:
last(/host/key) #retrieve the last value
last(/host/key,#2) #retrieve the previous value
last(/host/key,#1) <> last(/host/key,#2) #the last and previous values differCheck if the event ID of the last log entry matches a regular expression.
Supported value types: Log.
Returns: 0 - does not match; 1 - matches.
Parameters:
Examples:
logeventid(/host/eventlog[Security],,"4625")=1 #a log entry with ID matching "4625" (failed authentication) found
logeventid(/host/eventlog[System],,"6008|41")=1 #a log entry with ID matching "6008" or "41" foundLog severity of the last log entry.
Supported value types: Log.
Returns: 0 - default severity; N - severity (integer, useful for Windows event logs: 1 - Information, 2 - Warning, 4 - Error, 7 - Failure Audit, 8 - Success Audit, 9 - Critical, 10 - Verbose).
Parameters:
Zabbix takes log severity from the Information field of Windows event log.
Examples:
logseverity(/host/log[/var/log/syslog],10m)>3 #a log entry with severity above "3" found
logseverity(/host/eventlog[System],10m)=4 #a log entry with severity equaling "Error" foundCheck if log source of the last log entry matches a regular expression.
Supported value types: Log.
Returns: 0 - does not match; 1 - matches.
Parameters:
Normally used for Windows event logs.
Examples:
logsource(/host/eventlog[Application],,"MSSQLSERVER")=1 #a log entry with source matching "MSSQLSERVER" found
logsource(/host/eventlog[System],,"Service Control Manager")=1 #a log entry with source matching "Service Control Manager" found
logsource(/host/eventlog[System],,"Service Control Manager")=1 and logeventid(/host/eventlog[System],,"7031")=1 #a log entry with source matching "Service Control Manager" and event ID matching "7031" foundCheck if there has been a monotonous decrease in values.
Supported value types: Integer.
Returns: 1 - if all elements in the time period continuously decrease; 0 - otherwise.
Parameters:
Examples:
monodec(/host/system.swap.size[all,free],60s) + monodec(/host2/system.swap.size[all,free],60s) + monodec(/host3/system.swap.size[all,free],60s) #calculate in how many hosts there has been a decrease in free swap size
monodec(/host/proc.num[nginx],10m,"strict")=1 #the number of nginx processes has monotonously decreased over 10 minutesCheck if there has been a monotonous increase in values.
Supported value types: Integer.
Returns: 1 - if all elements in the time period continuously increase; 0 - otherwise.
Parameters:
Examples:
monoinc(/host/system.localtime,#3,"strict")=0 #the system local time has not been increasing consistently
monoinc(/host/vfs.dir.count[/mnt/data/logs],24h,"weak")=0 #trigger if the file count has stagnated over 24 hours (expected to grow)Check for no data received.
Supported value types: Integer, Float, Character, Text, Log.
Returns: 1 - if no data received during the defined period of time; 0 - otherwise.
Parameters:
nodata(/host/key,0) is disallowedComments:
nodata(/host/key,5m,"strict"); in this case the function will fire as soon as the evaluation period (five minutes) without data has past.Example:
The P-th percentile of a period, where P (percentage) is specified by the third parameter.
Supported value types: Float, Integer.
Parameters:
Examples:
percentile(/host/net.if.in[eth0,bytes],1h,95)>1000000 #95th percentile network input (bytes/sec) over 1 hour has gone beyond a threshold (e.g., 1 MB/s)
percentile(/host/system.cpu.util,5m,95)>80 #95th percentile of CPU utilization user-time percentage has gone above 80
percentile(/host/icmppingsec[192.168.0.2],15m,95)>0.15 #most latency measurements are below 150 ms but the higher-end tail (top 5%) implies regular lag
percentile(/host/net.if.in[eth0,bytes],1h,50) #calculate the 50th percentile (the median value) of incoming network traffic for an hour; this yields a different result from avg() (the average), as percentile does not consider outlier values
(percentile(/host/net.if.in[eth0,bytes],1h,50)+percentile(/host/net.if.in[eth0,bytes],1h,51))/2 #calculate precise median value with an even number of values for an hourThe per-second average rate of the increase in a monotonically increasing counter within the defined time period.
Supported value types: Float, Integer.
Parameters:
Functionally corresponds to 'rate' of PromQL.
Examples:
rate(/host/key,30s) #if the monotonic increase over 30 seconds is 20, this function returns 0.67.
rate(/host/net.if.in[eth0,bytes],5m)>500000 #the incoming interface traffic rate on eth0 has exceeded 500 KB/s over the past 5 minutes
rate(/host/app.requests.count,1m)>100 #the request count counter has risen at >100 requests per second in the last minute