InfluxDB 监听器输入插件
此插件监听根据 InfluxDB HTTP v1 API 发送的请求。这允许 Telegraf 作为 InfluxDB HTTP API 的 /write 端点的代理/路由器。
此插件以前称为 http_listener。如果您希望通过 HTTP 发送通用指标,建议改用 http_listener_v2。
/write 端点支持 precision 查询参数,可以设置为 ns、u、ms、s、m、h 之一。所有其他参数都将被忽略,并由输出插件的配置决定。
当链式连接 Telegraf 实例使用此插件时,CREATE DATABASE 请求将收到 200 OK 响应,消息体为 {"results":[]},但它们不会被中继。最终将数据提交到 InfluxDB 的输出插件的配置决定了目标数据库。
引入版本: Telegraf v1.9.0 标签: datastore 操作系统支持: all
服务输入
此插件是服务输入。普通插件收集由 interval 设置确定的指标。服务插件启动一个服务来监听并等待指标或事件发生。服务插件与普通插件的两个主要区别是:
- 全局或插件特定的
interval设置可能不适用 --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此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。