Available functions Flashcards
abschange
Returns absolute difference between last and previous values.
For strings:
0 - values are equal
1 - values differ
avg
The average value of a period. The period is set in seconds or as a number of collected values (preceded by a # hash mark, for example, #5 - five latest values) in the first parameter.
The function accepts a second, optional parameter time_shift. It is useful when there is a need to compare the current average value with the average value time_shift seconds back. For instance, avg(3600,86400) will return the average value for an hour one day ago.
change
Returns difference between last and previous values.
For strings:
0 - values are equal
1 - values differ
count (sec or #num)
The number of collected values in a period. The period is set in seconds or as a number of values (preceded by a # hash mark) in the first parameter.
The function accepts a second optional pattern parameter, a third operator parameter, and a fourth time_shift parameter.
For pattern: integer items - exact match; float items - match within 0.000001
Supported operators *:
eq - equal
(as for test bash)
like - matches if contains pattern.
*For integer and float items: operators eq (default), ne, gt, ge, lt, le are supported.
*For string, text and log items: operators like (default), eq, ne are supported.
Examples:
count(600) - the number of values for last 10 minutes
count(600,12) - the number of values for last 10 minutes that equal ‘12’
count(600,12,”gt”) - the number of values for last 10 minutes that are over ‘12’
date
Returns current date in YYYYMMDD format.
For example: 20031025
dayofmonth
Returns day of month in range of 1 to 31.
dayofweek
Returns day of week in range of 1 to 7. Mon - 1, Sun - 7.
delta
Returns the difference between the maximum and minimum values in a period (‘max()’ minus ‘min()’). The period is set in seconds or as a number of collected values (preceded by a # hash mark) in the first parameter.
Since Zabbix 1.8.2, the function supports a second, optional parameter time_shift. See function avg() for an example of its use.
diff
Returns:
1 - last and previous values differ
0 - otherwise
fuzzytime
Returns 1 if timestamp (item value) does not differ from Zabbix server time for more than N seconds, 0 - otherwise.
Usually used with system.localtime to check that local time is in sync with local time of Zabbix server.
iregexp (1st - string, 2nd - sec or #num)
This function is non case-sensitive analogue of regexp.
last (sec or #num)
Last (most recent) value. Parameter:
sec - ignored
#num - Nth most recent value
Take note that #num, as can be expected, works differently here than with many other functions.
For example,
last(0) is always equal to last(#1)
last(#3) - third most recent value (not three latest values)
The function also supports a second optional time_shift parameter. For example,
last(0,86400) will return the most recent value one day ago.
logeventid (string)
Check if Event ID of the last log entry matches a regular expression. Parameter defines the regular expression, POSIX extended style.
Returns:
0 - does not match
1 - matches
logseverity
Returns log severity of the last log entry. Parameter is ignored.
0 - default severity
N - severity (integer, useful for Windows event logs: 1 - Information, 2 - Warning, 4 - Error, 7 - Failure Audit, 8 - Success Audit). Zabbix takes log severity from field Information of Windows event log.
logsource (string)
Check if log source of the last log entry matches parameter.
0 - does not match
1 - matches
Normally used for Windows event logs. For example, logsource(“VMware Server”).