这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

7 Prediction functions

All functions listed here are supported in:

Some general notes on function parameters:

  • Function parameters are separated by a comma
  • Optional function parameters (or parameter parts) are indicated by < >
  • Function-specific parameters are described with each function
  • /host/key and (sec|#num)<:time shift> parameters must never be quoted
常用参数
  • /host/key 是引用主机监控项历史记录函数的常用强制性首选参数

  • (sec|#num)<:time shift> 是引用主机监控项历史记录函数的常用强制性次选参数 ,其中:

  • sec - 以秒为单位的最大 评估周期 (可以使用时间 后缀 ),或者

  • #num - 最新收集值最大 评估范围(如果前面有#符号)

  • time shift (可选) 允许将评估点及时移回。参阅有关指定时间偏移 更多详细内容

Function details

Some general notes on function parameters:

  • Function parameters are separated by a comma
  • Optional function parameters (or parameter parts) are indicated by < >
  • Function-specific parameters are described with each function
  • /host/key and (sec|#num)<:time shift> parameters must never be quoted
forecast(/host/key,(sec|#num)<:time shift>,time,<fit>,<mode>)

The future value, max, min, delta or avg of the item.
Supported value types: Float, Integer.

Parameters:

  • See common parameters;
  • time - the forecasting horizon in seconds (time suffixes can be used); negative values are supported;
  • fit (optional; must be double-quoted) - the function used to fit historical data. Supported fits:
    linear - linear function (default)
    polynomialN - polynomial of degree N (1 <= N <= 6)
    exponential - exponential function
    logarithmic - logarithmic function
    power - power function
    Note that polynomial1 is equivalent to linear;
  • mode (optional; must be double-quoted) - the demanded output. Supported modes:
    value - value (default)
    max - maximum
    min - minimum
    delta - max-min
    avg - average
    Note that value estimates the item value at the moment now + time; max, min, delta and avg investigate the item value estimate on the interval between now and now + time.

Comments:

  • If the value to return is larger than 1.7976931348623157E+308 or less than -1.7976931348623157E+308, the return value is cropped to 1.7976931348623157E+308 or -1.7976931348623157E+308 correspondingly;
  • Becomes unsupported only if misused in the expression (wrong item type, invalid parameters), otherwise returns -1 in case of errors;
  • See also additional information on predictive trigger functions.

Examples:

forecast(/host/key,#10,1h) #forecast the item value in one hour based on the last 10 values
       forecast(/host/key,1h,30m) #forecast the item value in 30 minutes based on the last hour data
       forecast(/host/key,1h:now-1d,12h) #forecast the item value in 12 hours based on one hour one day ago
       forecast(/host/key,1h,10m,"exponential") #forecast the item value in 10 minutes based on the last hour data and exponential function
       forecast(/host/key,1h,2h,"polynomial3","max") #forecast the maximum value the item can reach in the next two hours based on last hour data and cubic (third degree) polynomial
       forecast(/host/key,#2,-20m) #estimate the item value 20 minutes ago based on the last two values (this can be more precise than using last(), especially if the item is updated rarely, say, once an hour)
timeleft(/host/key,(sec|#num)<:time shift>,threshold,<fit>)

The time in seconds needed for an item to reach the specified threshold.
Supported value types: Float, Integer.

Parameters:

Comments:

  • If the value to return is larger than 1.7976931348623157E+308, the return value is cropped to 1.7976931348623157E+308;
  • Returns 1.7976931348623157E+308 if the threshold cannot be reached;
  • Becomes unsupported only if misused in the expression (wrong item type, invalid parameters), otherwise returns -1 in case of errors;
  • See also additional information on predictive trigger functions.

Examples:

timeleft(/host/key,#10,0) #the time until the item value reaches zero based on the last 10 values
       timeleft(/host/key,1h,100) #the time until the item value reaches 100 based on the last hour data
       timeleft(/host/key,1h:now-1d,100) #the time until the item value reaches 100 based on one hour one day ago
       timeleft(/host/key,1h,200,"polynomial2") #the time until the item value reaches 200 based on the last hour data and assumption that the item behaves like a quadratic (second degree) polynomial

See all supported functions.