文档文档

Amazon CloudWatch 输出插件

此插件将指标写入 Amazon CloudWatch 服务。

引入于: Telegraf v0.10.1 标签: cloud 操作系统支持: all

Amazon 认证

此插件使用凭证链进行身份验证以连接到 CloudWatch API 端点。插件将按以下顺序尝试进行身份验证。

  1. 通过 STS 的 Web 身份提供商凭证,如果指定了 role_arnweb_identity_token_file
  2. 如果指定了 role_arn 属性,则通过 STS 假定凭证 (源凭证从后续规则评估)
  3. 来自 access_keysecret_keytoken 属性的显式凭证
  4. 来自 profile 属性的共享配置文件
  5. 环境变量
  6. 共享凭证
  7. EC2 实例配置文件

如果您使用的是来自 Web 身份提供商的凭证,则可以使用 role_session_name 指定会话名称。如果留空,将使用当前时间戳。

IAM 用户只需要 cloudwatch:PutMetricData 权限。

全局配置选项

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

配置

# Configuration for AWS CloudWatch output.
[[outputs.cloudwatch]]
  ## Amazon REGION
  region = "us-east-1"

  ## Amazon Credentials
  ## Credentials are loaded in the following order
  ## 1) Web identity provider credentials via STS if role_arn and
  ##    web_identity_token_file are specified
  ## 2) Assumed credentials via STS if role_arn is specified
  ## 3) explicit credentials from 'access_key' and 'secret_key'
  ## 4) shared profile from 'profile'
  ## 5) environment variables
  ## 6) shared credentials file
  ## 7) EC2 Instance Profile
  #access_key = ""
  #secret_key = ""
  #token = ""
  #role_arn = ""
  #web_identity_token_file = ""
  #role_session_name = ""
  #profile = ""
  #shared_credential_file = ""

  ## Endpoint to make request against, the correct endpoint is automatically
  ## determined and this option should only be set if you wish to override the
  ## default.
  ##   ex: endpoint_url = "https://:8000"
  # endpoint_url = ""

  ## Set http_proxy
  # use_system_proxy = false
  # http_proxy_url = "https://:8888"

  ## Namespace for the CloudWatch MetricDatums
  namespace = "InfluxData/Telegraf"

  ## If you have a large amount of metrics, you should consider to send
  ## statistic values instead of raw metrics which could not only improve
  ## performance but also save AWS API cost. If enable this flag, this plugin
  ## would parse the required CloudWatch statistic fields (count, min, max, and
  ## sum) and send them to CloudWatch. You could use basicstats aggregator to
  ## calculate those fields. If not all statistic fields are available, all
  ## fields would still be sent as raw metrics.
  # write_statistics = false

  ## Enable high resolution metrics of 1 second (if not enabled, standard
  ## resolution are of 60 seconds precision)
  # high_resolution_metrics = false

为了使此输出插件正常工作,必须配置以下变量。

  • region
  • namespace

region

要连接的 Amazon 区域。示例包括但不限于

  • us-west-1
  • us-west-2
  • us-east-1
  • ap-southeast-1
  • ap-southeast-2

namespace

用于 AWS CloudWatch 指标的命名空间。

write_statistics

如果您有大量指标,建议发送统计值而不是原始指标,这不仅可以提高性能,还可以节省 AWS API 成本。如果启用此标志,此插件将解析所需的 CloudWatch 统计字段(count、min、max 和 sum)并将它们发送到 CloudWatch。您可以使用 basicstats 聚合器来计算这些字段。如果并非所有统计字段都可用,所有字段仍将作为原始指标发送。

high_resolution_metrics

启用高分辨率指标(1 秒精度)而不是标准指标(60 秒精度)。


此页面是否有帮助?

感谢您的反馈!


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