文档文档

InfluxDB 监听器输入插件

此插件监听根据 InfluxDB HTTP v1 API 发送的请求。这允许 Telegraf 作为 InfluxDB HTTP API 的 /write 端点的代理/路由器。

此插件以前称为 http_listener。如果您希望通过 HTTP 发送通用指标,建议改用 http_listener_v2

/write 端点支持 precision 查询参数,可以设置为 nsumssmh 之一。所有其他参数都将被忽略,并由输出插件的配置决定。

当链式连接 Telegraf 实例使用此插件时,CREATE DATABASE 请求将收到 200 OK 响应,消息体为 {"results":[]},但它们不会被中继。最终将数据提交到 InfluxDB 的输出插件的配置决定了目标数据库。

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

服务输入

此插件是服务输入。普通插件收集由 interval 设置确定的指标。服务插件启动一个服务来监听并等待指标或事件发生。服务插件与普通插件的两个主要区别是:

  1. 全局或插件特定的 interval 设置可能不适用
  2. --test--test-wait--once 的 CLI 选项可能不会为此插件生成输出

全局配置选项

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

配置

# Accept metrics over InfluxDB 1.x HTTP API
[[inputs.influxdb_listener]]
  ## Address and port to host HTTP listener on
  service_address = ":8186"

  ## maximum duration before timing out read of the request
  read_timeout = "10s"
  ## maximum duration before timing out write of the response
  write_timeout = "10s"

  ## Maximum allowed HTTP request body size in bytes.
  ## 0 means to use the default of 32MiB.
  max_body_size = 0

  ## Set one or more allowed client CA certificate file names to
  ## enable mutually authenticated TLS connections
  tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]

  ## Add service certificate and key
  tls_cert = "/etc/telegraf/cert.pem"
  tls_key = "/etc/telegraf/key.pem"

  ## Optional tag name used to store the database name.
  ## If the write has a database in the query string then it will be kept in this tag name.
  ## This tag can be used in downstream outputs.
  ## The default value of nothing means it will be off and the database will not be recorded.
  ## If you have a tag that is the same as the one specified below, and supply a database,
  ## the tag will be overwritten with the database supplied.
  # database_tag = ""

  ## If set the retention policy specified in the write query will be added as
  ## the value of this tag name.
  # retention_policy_tag = ""

  ## Optional username and password to accept for HTTP basic authentication
  ## or authentication token.
  ## You probably want to make sure you have TLS configured above for this.
  ## Use these options for the authentication token in the form
  ##   Authentication: Token <basic_username>:<basic_password>
  # basic_username = "foobar"
  # basic_password = "barfoo"

  ## Optional JWT token authentication for HTTP requests
  ## Please see the documentation at
  ##   https://docs.influxdb.org.cn/influxdb/v1.8/administration/authentication_and_authorization/#authenticate-using-jwt-tokens
  ## for further details.
  ## Please note: Token authentication and basic authentication cannot be used
  ##              at the same time.
  # token_shared_secret = ""
  # token_username = ""

  ## Influx line protocol parser
  ## 'internal' is the default. 'upstream' is a newer parser that is faster
  ## and more memory efficient.
  # parser_type = "internal"

Metrics

指标是从请求体中的 InfluxDB 行协议创建的。

示例输出

使用

curl -i -XPOST 'https://:8186/write' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'

将生成以下指标

cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000

此页面是否有帮助?

感谢您的反馈!


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