1 触发器函数
1 Supported trigger functions
所有触发器表达式支持的函数都在下表中。 All functions supported in trigger expressions are listed here.
函数 | |||
---|---|---|---|
FUNCTION |
描述信息 | 参数 | 备注 | |
---|---|---|---|
Description | Parameters | Comments | |
abschange |
后一个值与前一个值变动的绝对值。 | 支持的值类型: float, int, str, text, log 例如: (前一个值;后一个值=绝对值) 1;5=4 3;1=2 0;-2.5=2.5 值类型为str型的返回值: 0 - 两个str相等 1 - 两个str不相等 | ||
The amount of absolute difference between last and previous values. | Supported value types: float, int, str, text, log For example: (previous value;last value=abschange) 1;5=4 3;1=2 0;-2.5=2.5 For strings returns: 0 - values are equal 1 - values differ | ||
avg (sec|#num,<time_shift>) |
指定评估期内的一个item的平均值。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示 time_shift (可选) - 评估时间点相对于当前时间的偏移量 | 支持的值类型: float, int Examples: ⇒ avg(#5) → 最新5个值的平均值 ⇒ avg(1h) → 最近一小时的平均值 ⇒ avg(1h,1d) → 一天前的一小时内的平均值 从Zabbix 1.8.2开始支持 time_shift 参数。 主要用于将当前平均值与偏移若干秒后的平均值进行比较。 | |
Average value of an item within the defined evaluation period. | sec or #num - evaluation period in seconds or in latest collected values (preceded by a hash mark) time_shift (optional) - evaluation point is moved the number of seconds back in time | Supported value types: float, int Examples: ⇒ avg(#5) → average value for the five latest values ⇒ avg(1h) → average value for an hour ⇒ avg(1h,1d) → average value for an hour one day ago. The time_shift parameter is supported since Zabbix 1.8.2. It is useful when there is a need to compare the current average value with the average value time_shift seconds back. | |
band (sec|#num,mask,<time_shift>) |
将item值与mask进行按位与操作。 | sec (可省略) or #num - 第N个最近的价值。 mask (不可省略) - 64-bit无符号整数 (0 - 18446744073709551615) time_shift (可选) - 参见avg() 函数 | 支持的值类型: int 请注意 #num 在这里的工作方式与其他函数不同(具体用法参见last()函数)。\尽管以二进制方式进行比较,但是所有的参数和返回值都是十进制。 示例: ⇒ band(,12)=8 or band(,12)=4 → 第三位和第四位被设置,但不是同时设置。 ⇒ band(,20)=16 →第三位没有被设置但是第五位被设置了。 从Zabbix 2.2.0开始支持该函数。 | |
Value of “bitwise AND” of an item value and mask. | sec (ignored) or #num - the Nth most recent value mask (mandatory) - 64-bit unsigned integer (0 - 18446744073709551615) time_shift (optional) - see avg() | Supported value types: int Take note that #num works differently here than with many other functions (see last()).Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100. Examples: ⇒ band(,12)=8 or band(,12)=4 → 3rd or 4th bit set, but not both at the same time ⇒ band(,20)=16 → 3rd bit not set and 5th bit set. This function is supported since Zabbix 2.2.0. | |
change | |||
最近获取值与之前获取值的差。 | 支持值类型: float, int, str, text, log 例如: (前一个值;后一个值=差) 1;5=+4 3;1=-2 0;-2.5=-2.5 可与abschange函数对照。 值类型为str型的返回值: 0 - 两个str相等 1 - 两个str不相等 | ||
The amount of difference between last and previous values. | Supported value types: float, int, str, text, log For example: (previous value;last value=change) 1;5=+4 3;1=-2 0;-2.5=-2.5 See also: abschange for comparison For strings returns: 0 - values are equal 1 - values differ | ||
count (sec|#num,<pattern>,<operator>,<time_shift>) |
指定评估期内值出现的次数。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示。 pattern (可选) - 指定模式 operator (可选) 支持的操作符: eq - 等于 ne - 不等于 gt - 大于 ge - 大于等于 lt - 小于 le - 小于等于 like - 只要包含(区分大小写)就被匹配 band - 按位与 regexp - 按 pattern 参数进行正则表达式匹配(大小写敏感)iregexp - 按 pattern 参数进行正则表达式匹配(不区分大小)注意: eq (默认), ne, gt, ge, lt, le, band, regexp, iregexp仅仅支持整型数据。 eq (默认), ne, gt, ge, lt, le, regexp, iregexp仅仅支持浮点型数据。 like (默认), eq, ne, regexp, iregexp支持string, text和log类型数据。 time_shift (可选) - 参考avg()函数 | 支持值类型: float, integer, string, text, log 浮点类型的数据精度为0.000001。 band作为第三个参数时, 第二个参数 pattern 可以用’/‘分隔的两个数字表示: number_to_compare_with/mask。 count() 函数计算值和掩码的按位与,再和 number_to_compare_with 参数进行比较,如果与number_to_compare_with参数结果相等, 则该值被计数。如果参数number_to_compare_with和参数mask相等时, 只需要指定mask参数,不需要指定number_to_compare_with参数以及使用’/‘。 regexp或iregexp作为第三个参数时,第二个参数 pattern 可以是一个普通的或以 ‘@’开头的全局正则表达式。使用全局正则表达式时,是否大小写敏感取决于全局正则表达式的配置。为了进行正则表达式匹配,浮点值将始终用’.’后的4位数字表示。另请注意,对于十进制(存储在数据库中)和二进制(由Zabbix server使用)表示的数字差异,可能会对4位数字有影响。示例: ⇒ count(10m) → 过去10分钟值的个数。 ⇒ count(10m,”error”,eq) → 过去十分钟值等于’error’的个数。 ⇒ count(10m,12) → 过去10分钟值等于12的个数。 ⇒ count(10m,12,gt) → 过去10分钟值大于12的个数。 ⇒ count(#10,12,gt) → 最新10个值大于12的个数。 ⇒ count(10m,12,gt,1d) → 昨天这个时间点前十分钟值大于12的个数。 ⇒ count(10m,6/7,band) → 过去10分钟值最低三个有效位是 ‘110’ (二进制)的个数。 ⇒ count(10m,,,1d) → 昨天这个时间点前十分钟值的个数。 #num 参数从Zabbix 1.6.1开始获得支持。time_shift 参数和字符类型操作从Zabbix 1.8.2开始获得支持。band操作从Zabbix 2.2.0开始获得支持。 regexp, iregexp从Zabbix 3.2.0开始获得支持。 | |
Number of values within the defined evaluation period. | sec or #num - evaluation period in seconds or in latest collected values (preceded by a hash mark) pattern (optional) - required pattern operator (optional) Supported operators :eq - equal ne - not equal gt - greater ge - greater or equal lt - less le - less or equal like - matches if contains pattern (case-sensitive) band - bitwise AND regexp - case sensitive match of regular expression given in pattern iregexp - case insensitive match of regular expression given in pattern Note that: eq (default), ne, gt, ge, lt, le, band, regexp, iregexp are supported for integer items eq (default), ne, gt, ge, lt, le, regexp, iregexp are supported for float items like (default), eq, ne, regexp, iregexp are supported for string, text and log items time_shift (optional) - see avg() | Supported value types: float, integer, string, text, log Float items match with the precision of 0.000001. With band as third parameter, the second 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.If number_to_compare_with and mask are equal, only the mask need be specified (without ‘/‘). With regexp or iregexp as third parameter the second 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(10m) → number of values for last 10 minutes ⇒ count(10m,”error”,eq) → number of values for last 10 minutes that equal ‘error’ ⇒ count(10m,12) → number of values for last 10 minutes that equal ‘12’ ⇒ count(10m,12,gt) → number of values for last 10 minutes that are over ‘12’ ⇒ count(#10,12,gt) → number of values within last 10 values that are over ‘12’ ⇒ count(10m,12,gt,1d) → number of values for preceding 10 minutes up to 24 hours ago that were over ‘12’ ⇒ count(10m,6/7,band) → number of values for last 10 minutes having ‘110’ (in binary) in the 3 least significant bits. ⇒ count(10m,,,1d) → number of values for preceding 10 minutes up to 24 hours ago The #num parameter is supported since Zabbix 1.6.1.The time_shift parameter and string operators are supported since Zabbix 1.8.2.The band operator is supported since Zabbix 2.2.0. The regexp, iregexp operators are supported since Zabbix 3.2.0. | |
date | |||
当前时间,格式为:YYYYMMDD。 | 支持值类型: any 例如返回值: 20150731 | ||
Current date in YYYYMMDD format. | Supported value types: any Example of returned value: 20150731 | ||
dayofmonth | |||
当前是本月的第几天,取值范围从1到31。 | 支持值类型: any 从Zabbix 1.8.5开始支持该函数。 | ||
Day of month in range of 1 to 31. | Supported value types: any This function is supported since Zabbix 1.8.5. | ||
dayofweek | |||
当前是本周的第几天,取值范围从1到7 (周一 - 1, 周日 - 7). | 支持值的类型: any | ||
Day of week in range of 1 to 7 (Mon - 1, Sun - 7). | Supported value types: any | ||
delta (sec|#num,<time_shift>) | |||
指定评估期内最大值和最小值的差(‘max()’ 减去 ‘min()’)。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示。 time_shift (可选) - 参考avg()函数 | 支持值类型: float, int 从Zabbix 1.8.2开始支持 time_shift 参数。 | |
Difference between the maximum and minimum values within the defined evaluation period (‘max()’ minus ‘min()’). | sec or #num - evaluation period in seconds or in latest collected values specified (preceded by a hash mark) time_shift (optional) - see avg() | Supported value types: float, int The time_shift parameter is supported since Zabbix 1.8.2. | |
diff | |||
比较最近获取值与之前获取值是否相同。 | 支持值类型: float, int, str, text, log 返回值: 1 - 两值不等 0 - 两值相等 | ||
Checking if last and previous values differ. | Supported value types: float, int, str, text, log Returns: 1 - last and previous values differ 0 - otherwise | ||
forecast (sec|#num,<time_shift>,time,<fit>,<mode>) | |||
预测item未来的最大值,最小值,增量值或平均值。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示。 time_shift (可选) - 参考avg()函数 time - 需要预测的时间点 fit (可选) - 用于匹配历史数据的函数 支持的匹配函数: linear - 线性函数 polynomialN - N次多项式 (1 <= N <= 6) exponential - 指数函数 logarithmic - 对数函数 power - 幂函数 注意: linear函数为默认, polynomial1等同于linear mode (可选) - 按需输出 支持的 modes :value - 值 (默认) max - 最大值 min - 最小值 delta - 最大-最小 avg - 平均值 注意: value 预测item值在 now + time 时间点max, min, delta 和 avg 函数在 now 和 now + time 时间段计算item值 | 支持值类型: float, int 如果返回值大于 999999999999.9999 或者小于 -999999999999.9999, 返回值相应被设置为999999999999.9999 或 -999999999999.9999 。 只有在表达式被错误使用时才不可用(错误的项目类型,无效的参数),出现错误时返回-1。 Examples: ⇒ forecast(#10,,1h) → 根据最新的十个值预测一小时后的值 ⇒ forecast(1h,,30m) → 根据过去一小时的值预测三十分钟后的值 ⇒ forecast(1h,1d,12h) → 根据昨天这个时间点前一个小时的值预测十二个小时后的值 ⇒ forecast(1h,,10m,exponential) → 根据过去一小时的值并按照指数函数方式预测十分钟后的值 ⇒ forecast(1h,,2h,polynomial3,max) → 根据过去一小时的值并按照三次多项式方式预测两小时后的最大值 ⇒ forecast(#2,,-20m) → 根据最新的两个值预测二十分钟前的值 (比使用last()或prev()函数更加精确, 特别是item很少更新的时候, 比如说, 一小时一次) 从Zabbix 3.0.0开始支持该函数。 参数 time 允许负值从Zabbix 3.0.6和3.2.2开始支持。参考 触发器预测函数. | |
Future value, max, min, delta or avg of the item. | sec or #num - evaluation period in seconds or in latest collected values specified (preceded by a hash mark) time_shift (optional) - see avg() time - forecasting horizon in seconds fit (optional) - function used to fit historical data Supported fits :linear - linear function polynomialN - polynomial of degree N (1 <= N <= 6) exponential - exponential function logarithmic - logarithmic function power - power function Note that: linear is default, polynomial1 is equivalent to linear mode (optional) - demanded output Supported modes :value - value (default) max - maximum min - minimum delta - max-min avg - average Note that: value estimates item value at the moment now + time max, min, delta and avg investigate item value estimate on the interval between now and now + time | Supported value types: float, int If value to return is larger than 999999999999.9999 or less than -999999999999.9999, return value is cropped to 999999999999.9999 or -999999999999.9999 correspondingly. Becomes not supported only if misused in expression (wrong item type, invalid parameters), otherwise returns -1 in case of errors. Examples: ⇒ forecast(#10,,1h) → forecast of item value after one hour based on last 10 values ⇒ forecast(1h,,30m) → forecast of item value after 30 minutes based on last hour data ⇒ forecast(1h,1d,12h) → forecast of item after 12 hours based on one hour one day ago ⇒ forecast(1h,,10m,exponential) → forecast of item value after 10 minutes based on last hour data and exponential function ⇒ forecast(1h,,2h,polynomial3,max) → forecast of maximum value item can reach in next two hours based on last hour data and cubic (third degree) polynomial ⇒ forecast(#2,,-20m) → estimate the value of an item which was 20 minutes ago based on last two values (this can be more precise than using last() or prev(), especially if item is updated rarely, say, once an hour) This function is supported since Zabbix 3.0.0. Negative time values are supported since Zabbix 3.0.6 and 3.2.2.See also additional information on predictive trigger functions. | |
fuzzytime (sec) | |||
检查item的时间戳和zabbix server时间之间相差多大。 | sec - 秒数 | 支持值类型: float, int 返回值: 0 - item时间戳和zabbix server时间戳之间相差超过指定的时间 1 - 其它。 常使用system.localtime来检查本地时间是否与zabbix server的时间相同。 也可以使用vfs.file.time[/path/file,modify]键值检测文件是否长时间未更新。 例如: ⇒ fuzzytime(60)=0 → 如果时间差超过60秒,就会检测到一个问题 | |
Checking how much an item timestamp value differs from the Zabbix server time. | sec - seconds | Supported value types: float, int Returns: 0 - if difference between item timestamp value and Zabbix server timestamp is over T seconds 1 - otherwise. Usually used with system.localtime to check that local time is in sync with local time of Zabbix server. Can be used also with vfs.file.time[/path/file,modify] key to check that file didn’t get updates for long time. Example: ⇒ fuzzytime(60)=0 → detect a problem if time difference is over 60 seconds | |
iregexp (pattern,<sec|#num>) | |||
该函数和 regexp() 类似,只是不区分大小写。 | 参考regexp()函数 | 支持值类型: str, log, text | |
This function is a non case-sensitive analogue of regexp(). | see regexp() | Supported value types: str, log, text | |
last (sec|#num,<time_shift>) | |||
最近的值。 | sec (可省略) or #num - 最新的第N个值 time_shift (可选) - 参考avg()函数 | 支持值类型: float, int, str, text, log 注意此处的 #num 参数和在其它函数中的作用不一样。例如: last() 通常等同于 last(#1) last(#3) - 第三个最新值 (不是三个最新值) 如果在history中同一秒有多个值存在,Zabbix不能保证值的精确顺序。 从Zabbix 1.6.2开始支持 #num 参数。从Zabbix 1.8.2开始支持 time_shift 参数。 | |
The most recent value. | sec (ignored) or #num - the Nth most recent value time_shift (optional) - see avg() | Supported value types: float, int, str, text, log Take note that #num works differently here than with many other functions.For example: last() is always equal to last(#1) last(#3) - third most recent value (not three latest values) Zabbix does not guarantee exact order of values if more than two values exist within one second in history. The #num parameter is supported since Zabbix 1.6.2.The time_shift parameter is supported since Zabbix 1.8.2. | |
logeventid (pattern) | |||
检查最近日志记录的EventID是否匹配正则表达式。 | pattern - 正则表达式需要匹配的模式, 支持POSIX extended 类型。 | 支持值类型: log 返回值: 0 - 不匹配 1 - 匹配 从Zabbix 1.8.5开始支持该函数。 | |
Checking if event ID of the last log entry matches a regular expression. | pattern - regular expression describing the required pattern, Perl Compatible Regular Expression (PCRE) style. | Supported value types: log Returns: 0 - does not match 1 - matches This function is supported since Zabbix 1.8.5. | |
logseverity | |||
最近日志记录的日志等级。 | 支持值类型: log 返回值: 0 - 默认等级 N - 对应的等级 (整数,常用的Windows日志等级: 1 - 信息, 2 - 警告, 4 - 错误, 7 - 审计失败, 8 - 审计成功, 9 - 严重错误, 10 - Verbose). Zabbix从Windows日志事件中的 Information字段获取日志等级。 | ||
Log 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). Zabbix takes log severity from Information field of Windows event log. | ||
logsource (pattern) | |||
检查最近的日志记录是否匹配参数指定的日志来源。 | pattern - string类型 | 支持值类型: log 返回值: 0 - 不匹配 1 - 匹配 通常用于Windows日志事件。 例如, logsource(“VMware Server”). | |
Checking if log source of the last log entry matches parameter. | pattern - required string | Supported value types: log Returns: 0 - does not match 1 - matches Normally used for Windows event logs. For example, logsource(“VMware Server”). | |
max (sec|#num,<time_shift>) | |||
指定评估期内一个item的最大值。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示 time_shift (可选) - 参考avg()函数 | 支持值类型: float, int 从Zabbix 1.8.2开始支持 time_shift 参数。 | |
Highest value of an item within the defined evaluation period. | sec or #num - evaluation period in seconds or in latest collected values (preceded by a hash mark) time_shift (optional) - see avg() | Supported value types: float, int The time_shift parameter is supported since Zabbix 1.8.2. | |
min (sec|#num,<time_shift>) | |||
指定评估期内一个item的最小值。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示 time_shift (可选) - 参考avg()函数 | 支持值类型: float, int 从Zabbix 1.8.2开始支持 time_shift 参数。 | |
Lowest value of an item within the defined evaluation period. | sec or #num - evaluation period in seconds or in latest collected values (preceded by a hash mark) time_shift (optional) - see avg() | Supported value types: float, int The time_shift parameter is supported since Zabbix 1.8.2. | |
nodata (sec) | |||
检查评估期内是否接收到数据。 | sec - 评估期,单位为秒。 评估期不应该少于30秒,因为timer处理器每30秒调用一次该函数。 nodata(0) 不被允许. | 支持值类型: any 返回值: 1 - 指定评估期没有接收到数据 0 - 其它 注意,如果在第一个参数指定的时间内出现以下问题,该函数会报错: - Zabbix server被重启 - 刚出维护期 - item被添加或重新激活 - 错误显示在触发器配置界面的 Info 列。 | |
Checking for no data received. | sec - evaluation period in seconds. The period should not be less than 30 seconds because the timer process calculates this function only every 30 seconds. nodata(0) is disallowed. | Supported value types: any Returns: 1 - if no data received during the defined period of time 0 - otherwise Note that this function will display an error if, within the period of the 1st parameter: - there’s no data and Zabbix server was restarted - there’s no data and maintenance was completed - there’s no data and the item was added or re-enabled Errors are displayed in the Info column in trigger configuration. | |
now | |||
距离Epoch (00:00:00 UTC, January 1, 1970)的秒数。 | 支持值的类型: any | ||
Number of seconds since the Epoch (00:00:00 UTC, January 1, 1970). | Supported value types: any | ||
percentile (sec|#num,<time_shift>,percentage) | |||
P-th 一段时间的百分值, P (percentage) 做为第三个参数。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示 time_shift (可选) - 参考avg()函数 percentage - 0 到 100 (包括)之间的浮点数,小数点后最多保留四位 | 支持值类型: float, int 从Zabbix 3.0.0开始支持该函数。 | |
P-th percentile of a period, where P (percentage) is specified by the third parameter. | sec or #num - evaluation period in seconds or in latest collected values (preceded by a hash mark) time_shift (optional) - see avg() percentage - a floating-point number between 0 and 100 (inclusive) with up to 4 digits after the decimal point | Supported value types: float, int This function is supported since Zabbix 3.0.0. | |
prev | |||
取前一个值。 | 支持值类型: float, int, str, text, log 返回值和 last(#2)相同。 | ||
Previous value. | Supported value types: float, int, str, text, log Returns the same as last(#2). | ||
regexp (pattern,<sec|#num>) | |||
检查最近的值是否匹配正则表达式。 | pattern - 正则表达式, 支持POSIX extended 样式。 sec or #num (可选) - 评估期以多少秒或最新值个数(个数跟在#号后)表示。 这种情况下,可能有多个值被处理。 | 支持值类型: str, text, log 返回值: 1 - 匹配 0 - 不匹配。如果有多个值被处理,其中有一个值匹配也会返回1。 该函数区分大小写。 | |
Checking if the latest (most recent) value matches regular expression. | pattern - regular expression, Perl Compatible Regular Expression (PCRE) style. sec or #num (optional) - evaluation period in seconds or in latest collected values (preceded by a hash mark). In this case, more than one value may be processed. | Supported value types: str, text, log Returns: 1 - found 0 - otherwise If more than one value is processed, ‘1’ is returned if there is at least one matching value. This function is case-sensitive. | |
str (pattern,<sec|#num>) | |||
从最新值中查找一个字符串。 | pattern - string型 sec or #num (可选) - 评估期以多少秒或最新值个数(个数跟在#号后)表示。 这种情况下,可能有多个值被处理。 | 支持值类型: str, text, log 返回值: 1 - 找到 0 - 没找到。如果有多个值被处理,其中有一个值找到也会返回1。 该函数区分大小写。 | |
Finding a string in the latest (most recent) value. | pattern - required string sec or #num (optional) - evaluation period in seconds or in latest collected values (preceded by a hash mark). In this case, more than one value may be processed. | Supported value types: str, text, log Returns: 1 - found 0 - otherwise If more than one value is processed, ‘1’ is returned if there is at least one matching value. This function is case-sensitive. | |
strlen (sec|#num,<time_shift>) | |||
最新值的字符长度(而不是字节数)。 | sec (可省略) or #num - 最新的第N个值 time_shift (可选) - 参考avg()函数 | 支持值类型: str, text, log 注意此处的 #num 参数和它在其它函数中的作用不一样。示例: ⇒ strlen()(等同于 strlen(#1)) → 最新值的长度 ⇒ strlen(#3) → 最新的第三个值的长度 ⇒ strlen(,1d) → 一天前最新值的长度。 从Zabbix 1.8.4开始支持该函数。 | |
Length of the latest (most recent) value in characters (not bytes). | sec (ignored) or #num - the Nth most recent value time_shift (optional) - see avg() | Supported value types: str, text, log Take note that #num works differently here than with many other functions.Examples: ⇒ strlen()(is equal to strlen(#1)) → length of the latest value ⇒ strlen(#3) → length of the third most recent value ⇒ strlen(,1d) → length of the most recent value one day ago. This function is supported since Zabbix 1.8.4. | |
sum (sec|#num,<time_shift>) | |||
指定评估期内item值的和。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示 time_shift (可选) - 参考avg()函数 | 支持值类型: float, int 从Zabbix 1.8.2开始支持 time_shift 参数。 | |
Sum of collected values within the defined evaluation period. | sec or #num - evaluation period in seconds or in latest collected values (preceded by a hash mark) time_shift (optional) - see avg() | Supported value types: float, int The time_shift parameter is supported since Zabbix 1.8.2. | |
time | |||
当前时间,以HHMMSS格式表示。 | 支持值类型: any 返回值如: 123055 | ||
Current time in HHMMSS format. | Supported value types: any Example of returned value: 123055 | ||
timeleft (sec|#num,<time_shift>,threshold,<fit>) | |||
item达到定义阀值需要多久时间,单位为秒。 | sec or #num - 评估期以多少秒或最新值个数(个数跟在#号后)表示 time_shift (可选) - 参考 avg()函数 threshold - 阀值 fit (可选) - 参考forecast()函数 | 支持值类型: float, int 如果返回值大于 999999999999.9999, 则被设置为999999999999.9999。 如果达不到阀值也将返回值设置为999999999999.9999。 只有在表达式错误时才不可用(错误的item类型,无效的参数),出现错误时返回-1。 示例: ⇒ timeleft(#10,,0) → 根据最新的十个值计算值达到0需要的时间 ⇒ timeleft(1h,,100) → 根据过去一小时的值计算值达到100需要的时间 ⇒ timeleft(1h,1d,0) → 根据昨天当前时间点前一个小时的值计算值达到0需要的时间 ⇒ timeleft(1h,,200,polynomial2) → 根据过去一小时的值并按照二次多项式方式计算值达到200需要的时间 从Zabbix 3.0.0开始支持该函数。 从Zabbix 3.0.6 和 3.2.2开始支持Unit symbols 的 threshold 参数。通过 predictive trigger functions查看扩展信息。 | |
Time in seconds needed for an item to reach a specified threshold. | sec or #num - evaluation period in seconds or in latest collected values specified (preceded by a hash mark) time_shift (optional) - see avg() threshold - value to reach fit (optional) - see forecast() | Supported value types: float, int If value to return is larger than 999999999999.9999, return value is cropped to 999999999999.9999. Returns 999999999999.9999 if threshold cannot be reached. Becomes not supported only if misused in expression (wrong item type, invalid parameters), otherwise returns -1 in case of errors. Examples: ⇒ timeleft(#10,,0) → time until item value reaches zero based on last 10 values ⇒ timeleft(1h,,100) → time until item value reaches 100 based on last hour data ⇒ timeleft(1h,1d,0) → time until item value reaches 0 based on one hour one day ago ⇒ timeleft(1h,,200,polynomial2) → time until item reaches 200 based on last hour data and assumption that item behaves like quadratic (second degree) polynomial This function is supported since Zabbix 3.0.0. Unit symbols in threshold parameter are supported since Zabbix 3.0.6 and 3.2.2.See also additional information on predictive trigger functions. |
1) 所有函数返回值都为数值类型。例如,不可能返回字符型数据。
2) 部分函数不能用于非数值类型数据。
3) 字符型参数都应该使用双引号。否则,可能会被错误解析。
4) 所有trigger函数中的sec 和 time_shift参数都必须是数值类型。 时间单位后缀与item的数据类型完全无关。
1) All functions return numeric values only. Comparison to strings is not supported, for example.
2) Some of the functions cannot be used for non-numeric parameters!
3) String arguments should be double quoted. Otherwise, they might get misinterpreted.
4) For all trigger functions sec and time_shift must be an integer with an optional time unit suffix and has absolutely nothing to do with item’s data type.
函数与unsupported item
Functions and unsupported items
从Zabbix 3.2开始, nodata(), date(), dayofmonth(), dayofweek(), now() 和 time() 函数都支持用于unsupported item。 但其他函数都要求用于supported item。
Starting from Zabbix 3.2, nodata(), date(), dayofmonth(), dayofweek(), now() and time() functions are calculated for unsupported items, too. Other functions require that the referenced item is in a supported state.