文档文档

Derivative Aggregator 插件

此插件计算聚合指标的所有字段的导数。

引入于: Telegraf v1.18.0 标签: math 操作系统支持: all

全局配置选项

插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md

配置

# Calculates a derivative for every field.
[[aggregators.derivative]]
  ## The period in which to flush the aggregator.
  # period = "30s"

  ## Suffix to append for the resulting derivative field.
  # suffix = "_rate"

  ## Field to use for the quotient when computing the derivative.
  ## When using a field as the derivation parameter the name of that field will
  ## be used for the resulting derivative, e.g. *fieldname_by_parameter*.
  ## By default the timestamps of the metrics are used and the suffix is omitted.
  # variable = ""

  ## Maximum number of roll-overs in case only one measurement is found during a period.
  # max_roll_over = 10

此聚合器将估算指标每个字段的导数,该指标包含在聚合区间的第一个和最后一个指标中。如果未进行进一步配置,则导数将相对于这两个测量值之间以秒为单位的时间差进行计算。对于每个字段都应用以下公式

derivative = (value_last - value_first) / (time_last - time_first)

如果未配置 suffix,则生成的导数将命名为 <fieldname>_rate

要计算每个字段的导数,请使用

[[aggregators.derivative]]
  ## Specific Derivative Aggregator Arguments:

  ## Configure a custom derivation variable. Timestamp is used if none is given.
  # variable = ""

  ## Suffix to add to the field name for the derivative name.
  # suffix = "_rate"

  ## Roll-Over last measurement to first measurement of next period
  # max_roll_over = 10

  ## General Aggregator Arguments:

  ## calculate derivative every 30 seconds
  period = "30s"

时间导数

在其默认配置中,它确定周期内第一个和最后一个测量值。从这些测量值中计算出以秒为单位的时间差。然后,使用以下公式将此时间差用于除以每个字段的差值

derivative = (value_last - value_first) / (time_last - time_first)

对于每个字段,导数都以命名模式 <fieldname>_rate 发出。

自定义推导变量

该插件支持使用聚合测量值的字段作为分母中的推导变量。假定此变量是单调递增的值。在此功能中,使用以下公式

derivative = (value_last - value_first) / (variable_last - variable_first)

确保指定的变量未被过滤,并且存在于传递给此聚合器的指标中!

使用自定义推导变量时,应更改导数名称的 suffix。请参阅下一节关于自定义导数名称 | | 16 | 4.0 | | | | | | 18 | 2.0 | | | | | | 20 | 0.0 | | | | | ||| -1.0 | -1.0 | | |

差异源于周期之间值的变化,例如,从第一个周期到第二个周期从 6.0 变为 8.0。使用 max_roll_over = 0 时会忽略这些变化,但使用 max_roll_over = 1 时会考虑。计算出的导数没有更多差异是由于示例数据,该数据在第一个和最后一个周期内具有恒定的导数,即使包含周期之间的间隔。如果需要检测周期之间的变化,例如当一个周期内的测量值非常少或准恒定指标只有偶尔变化时,使用大于 0 的 max_roll_over 值可能很重要。

标签

此聚合器不应用任何标签。现有的标签将保持不变地通过聚合器。

示例输出

net bytes_recv=15409i,packets_recv=164i,bytes_sent=16649i,packets_sent=120i 1508843640000000000
net bytes_recv=73987i,packets_recv=364i,bytes_sent=87328i,packets_sent=452i 1508843660000000000
net bytes_recv_by_packets_recv=292.89 1508843660000000000
net packets_sent_rate=16.6,bytes_sent_rate=3533.95 1508843660000000000
net bytes_sent_by_packet=292.89 1508843660000000000

此页面是否有帮助?

感谢您的反馈!


InfluxDB 3.8 新特性

InfluxDB 3.8 和 InfluxDB 3 Explorer 1.6 的主要增强功能。

查看博客文章

InfluxDB 3.8 现已适用于 Core 和 Enterprise 版本,同时发布了 InfluxDB 3 Explorer UI 的 1.6 版本。本次发布着重于操作成熟度,以及如何更轻松地部署、管理和可靠地运行 InfluxDB。

更多信息,请查看

InfluxDB Docker 的 latest 标签将指向 InfluxDB 3 Core

在 **2026 年 2 月 3 日**,InfluxDB Docker 镜像的 latest 标签将指向 InfluxDB 3 Core。为避免意外升级,请在您的 Docker 部署中使用特定的版本标签。

如果使用 Docker 来安装和运行 InfluxDB,latest 标签将指向 InfluxDB 3 Core。为避免意外升级,请在您的 Docker 部署中使用特定的版本标签。例如,如果使用 Docker 运行 InfluxDB v2,请将 latest 版本标签替换为 Docker pull 命令中的特定版本标签 — 例如

docker pull influxdb:2