文档文档

Dynatrace 输出插件

此插件通过 Dynatrace Metrics API V2 将指标写入 Dynatrace。它可以与 Dynatrace OneAgent 一起运行以实现自动身份验证,或者可以通过指定 URL 和 API Token 在没有 OneAgent 的主机上独立运行。

有关该插件的更多信息,请参阅 Dynatrace 文档

所有指标都报告为仪表盘,除非它们被指定为增量计数器(使用 additional_countersadditional_counters_patterns 配置选项,见下文)。有关那里定义的类型,请参阅 Dynatrace Metrics ingestion protocol 文档

引入版本: Telegraf v1.16.0 标签: cloud, datastore 操作系统支持: all

要求

您需要安装Dynatrace OneAgent(版本 1.201 或更高版本)在与Telegraf相同的宿主机上;或者使用版本 1.202 或更高版本的Dynatrace环境。

  • Telegraf 最低版本: Telegraf 1.16

入门

Telegraf 的设置解释在 Telegraf 文档 中。通过在 telegraf.conf 配置文件中添加 [[outputs.dynatrace]] 部分来启用 Dynatrace 导出器。所有配置项都是可选的,但如果指定了一个非 OneAgent 指标摄入端点的 url,则需要 api_token。要查看所有可用选项,请参阅下面的配置。

与 Dynatrace OneAgent 一起运行(推荐)

如果您在由 Dynatrace OneAgent 监控的宿主机或虚拟机上运行 Telegraf 代理,那么您只需要启用该插件,无需进一步配置。Dynatrace Telegraf 输出插件会将所有指标发送到 OneAgent,OneAgent 将使用其安全且负载均衡的连接将指标发送到您的 Dynatrace SaaS 或 Managed 环境。根据您的环境,您可能需要先在 OneAgent 上启用指标摄入,如 Dynatrace 文档 中所述。

注意:运行 Telegraf 的宿主机的名称和标识符将作为维度添加到每个指标中。如果不需要这样做,则可以使用下面的说明以独立模式运行输出插件。

[[outputs.dynatrace]]
  ## No options are required. By default, metrics will be exported via the OneAgent on the local host.

独立运行

如果您在没有 OneAgent 的宿主机或虚拟机上运行 Telegraf 代理,您需要配置要发送指标的环境 API 端点以及用于安全访问的 API 令牌。

您还需要配置 API 令牌以进行安全访问。在 Dynatrace 文档 中了解如何创建令牌,或直接在 Dynatrace 环境中导航到 Settings > Integration > Dynatrace API,然后创建一个具有 Dynatrace API 权限并启用“Ingest metrics”(metrics.ingest)范围的新令牌。建议将令牌范围限制在此权限上。

Dynatrace Metrics API v2 的端点是

  • 在 Dynatrace Managed 上: https://{your-domain}/e/{your-environment-id}/api/v2/metrics/ingest
  • 在 Dynatrace SaaS 上: https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/ingest
[[outputs.dynatrace]]
  ## If no OneAgent is running on the host, url and api_token need to be set

  ## Dynatrace Metrics Ingest v2 endpoint to receive metrics
  url = "https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/ingest"

  ## API token is required if a URL is specified and should be restricted to the 'Ingest metrics' scope
  api_token = "your API token here" // hard-coded for illustration only, should be read from environment

您可以了解更多关于如何使用 Dynatrace API 的信息。

全局配置选项

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

Secret-store 支持

此插件支持来自 secret-stores 的 api_token 选项的 secret。有关如何使用它们的更多详细信息,请参阅 secret-store 文档

配置

# Send telegraf metrics to a Dynatrace environment
[[outputs.dynatrace]]
  ## For usage with the Dynatrace OneAgent you can omit any configuration,
  ## the only requirement is that the OneAgent is running on the same host.
  ## Only setup environment url and token if you want to monitor a Host without the OneAgent present.
  ##
  ## Your Dynatrace environment URL.
  ## For Dynatrace OneAgent you can leave this empty or set it to "http://127.0.0.1:14499/metrics/ingest" (default)
  ## For Dynatrace SaaS environments the URL scheme is "https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/ingest"
  ## For Dynatrace Managed environments the URL scheme is "https://{your-domain}/e/{your-environment-id}/api/v2/metrics/ingest"
  url = ""

  ## Your Dynatrace API token.
  ## Create an API token within your Dynatrace environment, by navigating to Settings > Integration > Dynatrace API
  ## The API token needs data ingest scope permission. When using OneAgent, no API token is required.
  api_token = ""

  ## Optional prefix for metric names (e.g.: "telegraf")
  prefix = "telegraf"

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Optional flag for ignoring tls certificate check
  # insecure_skip_verify = false

  ## Connection timeout, defaults to "5s" if not set.
  timeout = "5s"

  ## If you want metrics to be treated and reported as delta counters, add the metric names here
  additional_counters = [ ]

  ## In addition or as an alternative to additional_counters, if you want metrics to be treated and
  ## reported as delta counters using regular expression pattern matching
  additional_counters_patterns = [ ]

  ## NOTE: Due to the way TOML is parsed, tables must be at the END of the
  ## plugin definition, otherwise additional config options are read as part of
  ## the table

  ## Optional dimensions to be added to every metric
  # [outputs.dynatrace.default_dimensions]
  # default_key = "default value"

url

必需: false

默认: 本地 OneAgent 端点

如果您不使用 OneAgent 或希望直接将指标导出到 Dynatrace metrics v2 端点,请设置您的 Dynatrace 环境 URL(例如:https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/ingest,有关详细信息,请参阅 Dynatrace 文档)。如果 URL 设置为除本地 OneAgent 端点之外的其他任何值,则需要 API 令牌。

url = "https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/ingest"

api_token

必需: false,除非指定了 url

如果指定了除 OneAgent 端点以外的 URL,则需要 API 令牌,并且应将其限制为“Ingest metrics”范围。

api_token = "your API token here"

prefix

必需: false

可选前缀,将添加到所有指标名称之前(将用 . 分隔)。

prefix = "telegraf"

insecure_skip_verify

必需: false

将此选项设置为 true 会跳过 TLS 验证,用于测试或在使用自签名证书时。

insecure_skip_verify = false

additional_counters

必需: false

如果您希望将某个指标视为增量计数器并报告它,请将其名称添加到此列表中。

additional_counters = [ ]

additional_counters_patterns

必需: false

除了 additional_counters 之外,或者作为其替代,如果您希望使用正则表达式将某个指标视为增量计数器并报告它,请将其模式添加到此列表中。

additional_counters_patterns = [ ]

default_dimensions

必需: false

将添加到每个导出指标的默认维度。

[outputs.dynatrace.default_dimensions]
default_key = "default value"

限制

无法转换为数字的 Telegraf 测量值将被跳过。


此页面是否有帮助?

感谢您的反馈!


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