除非另有说明,此处列出的所有功能均受支持 在:
聚合函数可以使用:
min(/host/key,1h)
min(last_foreach(/*/key))
关于函数参数的一些一般说明:
<
>
/host/key
和 (sec|#num)<:time shift>
参数绝不能 引用/host/key
是函数的常见强制性第一个参数 引用主机监控项历史(sec|#num)<:time shift>
是常见的第二个参数 引用主机监控项历史的函数,其中
函数 | |||
---|---|---|---|
描述 | 特定函数参数 | 注释 | |
avg (/host/key,(sec|#num)<:time shift>) | |||
监控项在定义的评估期内的平均值。 | 参考 common parameters. | 支持的值类型 : float, int 例子: => avg(/host/key,1h) → 最后一小时的平均值,直到 now => avg(/host/key,1h:now-1d) → 从 25 小时前到 24 小时前一小时的平均值 now => avg(/host/key,#5) → 五个最新值的平均值 => avg(/host/key,#5:now-1d) → 不包括最近 24 小时内收到的值的五个最新值的平均值 当需要将当前平均值与前一段时间的平均值进行比较时,时移很有用. |
|
bucket_percentile (监控项 过滤器、时间段、百分比) | |||
从直方图的桶中计算百分位数. | item filter - 参看 item filter time period - 参看 time period percentage - 百分比 (0-100) |
仅在计算监控项中支持. 这个函数是一个别名 histogram_quantile(percentage/100, bucket_rate_foreach(item filter, time period, 1)) |
|
count (func_foreach(item filter,<time period>)) | |||
foreach 函数返回的数组中的值的计数. | func_foreach - 应计算返回值数量的 foreach 函数(带有支持的参数). 参看 foreach functions 详情. | 支持的值类型: int 例子: => count(max_foreach(/*/net.if.in[*],1h)) → number of net.if.in items that received data in the last hour until now 请注意,使用 count() 使用与历史相关的 foreach 函数(max_foreach、avg_foreach 等)可能会影响性能,而使用 exists_foreach(), 仅适用于配置数据,不会有这样的效果. |
|
histogram_quantile (quantile,bucket1,value1,bucket2,value2,...) | |||
从直方图的桶中计算 φ 分位数。 | quantile - 0 ≤ φ ≤ 1 bucketN, valueN - 手动输入的参数对 (>=2) 或 [bucket_rate_foreach] (/manual/appendix/functions/aggregate/foreach) |
仅在计算项中支持。 功能对应'histogram_quantile' 参考PromQL. 如果最后一个 'Infinity' 存储桶 ("+inf") 的值等于 0,则返回 -1。 例子: => histogram_quantile(0.75,1.0,last(/host/rate_bucket[1.0]),"+Inf",last(/host/rate_bucket[Inf]) => histogram_quantile(0.5,bucket_rate_foreach(//item_key,30s)) |
|
item_count (item filter) | |||
配置中与筛选条件匹配的现有项目的计数. | item filter - 项目选择标准,允许按主机组、主机、监控项键和标签进行引用。支持通配符 参看 item filter 更多详情. | 支持数据类型: int 作为别名工作count(exists_foreach(item_filter)) 函数. 例子: => item_count(/*/agent.ping?[group="Host group 1"]) → 主机组"Host group 1"中带有 agent.ping 项的主机数量 |
|
kurtosis (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集值的概率分布的“Tailedness”。 See also: Kurtosis |
参看 common parameters. | 支持数据类型: float, int 例子: => kurtosis(/host/key,1h) → kurtosis 最后一小时,直到now |
|
mad (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集值的中值绝对偏差. 另见: Median absolute deviation |
参看 common-parameters. | 支持的数据类型: float, int 例子: => mad(/host/key,1h) → 最后一小时的绝对偏差中位数,直到 now |
|
max (/host/key,(sec|#num)<:time shift>) | |||
监控项在规定的评估期内的最高值。 | 参看 common parameters. | 支持的数据类型: float, int 例子: => max(/host/key,1h) - min(/host/key,1h) → 计算最后一小时内的最大值和最小值之间的差,直到 now (值的增量) |
|
min (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内监控项的最低值。 | 参看 common parameters. | 支持的数据类型: float, int Example: => max(/host/key,1h) - min(/host/key,1h) → 计算最后一小时内的最大值和最小值之间的差,直到 now (值的增量) |
|
skewness (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集值的概率分布对称。 参见: Skewness |
参看 common parameters. | 支持的数据类型: float, int Example: => skewness(/host/key,1h) → 最后一小时的偏度,直到now |
|
stddevpop (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集的值的总体标准偏差。 参见: Standard deviation |
参看 common parameters. | 支持的数据类型: float, int 例子: => stddevpop(/host/key,1h) → 最后一小时的总体标准差,直到 now |
|
stddevsamp (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集的值的样本标准偏差。 参见: Standard deviation |
参看 common parameters. | 支持的数据类型: float, int 此功能至少需要两个数据值才能工作。 例子: => stddevsamp(/host/key,1h) → 最后一小时的样本标准偏差,直到 now |
|
sum (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集的值的总和。 | 参看 common parameters. | 支持的数据类型: float, int 例子: => sum(/host/key,1h) → 最后一小时的值总和,直到 now |
|
sumofsquares (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集的值的平方和。 | 参看 common parameters. | 支持的数据类型: float, int 例子: => sumofsquares(/host/key,1h) → 最后一小时的平方和,直到 now |
|
varpop (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集的值的总体方差。 参见: Variance |
参看 common parameters. | 支持的数据类型: float, int Example: => varpop(/host/key,1h) → 最后一小时的总体方差,直到 now |
|
varsamp (/host/key,(sec|#num)<:time shift>) | |||
在定义的评估期内收集值的样本方差。 参见: Variance |
参看 common parameters. | 支持的数据类型: float, int 此功能至少需要两个数据值才能工作。. 例子: => varsamp(/host/key,1h) → 最后一小时的样本方差,直到 now |