目录
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它会更有价值。InfluxDB 是排名第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法
输入和输出集成概述
NATS Consumer Input Plugin 允许从 NATS 消息主题实时消费数据,无缝集成到 Telegraf 数据管道中,用于监控和指标收集。
Graphite 插件允许用户通过 TCP 将 Telegraf 收集的指标发送到 Graphite。此集成允许使用 Graphite 的强大功能高效地存储和可视化时间序列数据。
集成详情
NATS
NATS Consumer Plugin 允许 Telegraf 从指定的 NATS 主题读取指标,并根据支持的输入数据格式创建指标。利用队列组允许多个 Telegraf 实例并行地从 NATS 集群读取数据,从而提高吞吐量和可靠性。此插件还支持各种身份验证方法,包括用户名/密码、NATS 凭据文件和 nkey 种子文件,确保与 NATS 服务器的安全通信。由于 JetStream 等功能有助于消费历史消息,因此它在数据持久性和消息可靠性至关重要的环境中特别有用。此外,配置各种操作参数的能力使此插件适用于高吞吐量场景,同时保持性能完整性。
Graphite
此插件通过原始 TCP 将指标写入 Graphite,从而将 Telegraf 收集的指标无缝集成到 Graphite 生态系统中。借助此插件,用户可以配置多个 TCP 端点以进行负载均衡,从而确保指标传输的高可用性和可靠性。使用前缀自定义指标命名和利用各种模板选项的能力增强了数据在 Graphite 中的表示方式的灵活性。此外,对 Graphite 标签和严格清理指标名称选项的支持允许进行强大的数据管理,以满足用户的各种需求。此功能对于希望利用 Graphite 强大的指标存储和可视化功能,同时保持对数据表示控制的组织至关重要。
配置
NATS
[[inputs.nats_consumer]]
## urls of NATS servers
servers = ["nats://localhost:4222"]
## subject(s) to consume
## If you use jetstream you need to set the subjects
## in jetstream_subjects
subjects = ["telegraf"]
## jetstream subjects
## jetstream is a streaming technology inside of nats.
## With jetstream the nats-server persists messages and
## a consumer can consume historical messages. This is
## useful when telegraf needs to restart it don't miss a
## message. You need to configure the nats-server.
## https://docs.nats.io/nats-concepts/jetstream.
jetstream_subjects = ["js_telegraf"]
## name a queue group
queue_group = "telegraf_consumers"
## Optional authentication with username and password credentials
# username = ""
# password = ""
## Optional authentication with NATS credentials file (NATS 2.0)
# credentials = "/etc/telegraf/nats.creds"
## Optional authentication with nkey seed file (NATS 2.0)
# nkey_seed = "/etc/telegraf/seed.txt"
## Use Transport Layer Security
# secure = false
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Sets the limits for pending msgs and bytes for each subscription
## These shouldn't need to be adjusted except in very high throughput scenarios
# pending_message_limit = 65536
# pending_bytes_limit = 67108864
## Max undelivered messages
## This plugin uses tracking metrics, which ensure messages are read to
## outputs before acknowledging them to the original broker to ensure data
## is not lost. This option sets the maximum messages to read from the
## broker that have not been written by an output.
##
## This value needs to be picked with awareness of the agent's
## metric_batch_size value as well. Setting max undelivered messages too high
## can result in a constant stream of data batches to the output. While
## setting it too low may never flush the broker's messages.
# max_undelivered_messages = 1000
## Data format to consume.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
data_format = "influx"
Graphite
# Configuration for Graphite server to send metrics to
[[outputs.graphite]]
## TCP endpoint for your graphite instance.
## If multiple endpoints are configured, the output will be load balanced.
## Only one of the endpoints will be written to with each iteration.
servers = ["localhost:2003"]
## Local address to bind when connecting to the server
## If empty or not set, the local address is automatically chosen.
# local_address = ""
## Prefix metrics name
prefix = ""
## Graphite output template
## see https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
template = "host.tags.measurement.field"
## Strict sanitization regex
## This is the default sanitization regex that is used on data passed to the
## graphite serializer. Users can add additional characters here if required.
## Be aware that the characters, '/' '@' '*' are always replaced with '_',
## '..' is replaced with '.', and '\' is removed even if added to the
## following regex.
# graphite_strict_sanitize_regex = '[^a-zA-Z0-9-:._=\p{L}]'
## Enable Graphite tags support
# graphite_tag_support = false
## Applied sanitization mode when graphite tag support is enabled.
## * strict - uses the regex specified above
## * compatible - allows for greater number of characters
# graphite_tag_sanitize_mode = "strict"
## Character for separating metric name and field for Graphite tags
# graphite_separator = "."
## Graphite templates patterns
## 1. Template for cpu
## 2. Template for disk*
## 3. Default template
# templates = [
# "cpu tags.measurement.host.field",
# "disk* measurement.field",
# "host.measurement.tags.field"
#]
## timeout in seconds for the write connection to graphite
# timeout = "2s"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
输入和输出集成示例
NATS
-
实时分析仪表板:利用 NATS 插件实时收集来自各种 NATS 主题的指标,并将它们馈送到集中的分析仪表板。此设置允许立即查看实时应用程序性能,使团队能够快速响应操作问题或性能下降。
-
分布式系统监控:在分布式架构中部署配置了 NATS 插件的多个 Telegraf 实例。这种方法允许团队有效地聚合来自各种微服务的指标,从而提供系统健康状况和性能的整体视图,同时确保在传输过程中不会丢失任何消息。
-
历史消息恢复:利用 NATS JetStream 的功能以及此插件,在 Telegraf 重新启动后恢复和处理历史消息。此功能对于需要高可靠性的应用程序特别有益,即使在服务中断的情况下也能确保不会丢失任何关键指标。
-
动态负载均衡:实施动态负载均衡场景,其中 Telegraf 实例根据负载从 NATS 集群消费消息。调整队列组设置以控制活动消费者的数量,从而在需求波动发生时实现更好的资源利用率和性能扩展。
Graphite
-
动态指标可视化:Graphite 插件可用于将来自各种来源(例如应用程序性能数据或服务器健康状况指标)的实时指标馈送到 Graphite。这种动态集成允许团队创建交互式仪表板,以可视化关键绩效指标、跟踪随时间变化的趋势,并做出数据驱动的决策以增强系统性能。
-
负载均衡指标收集:通过在插件中配置多个 TCP 端点,组织可以为指标传输实施负载均衡。此用例确保指标交付既具有弹性又高效,从而降低高流量期间数据丢失的风险,并保持向 Graphite 的可靠信息流。
-
自定义指标标记:借助对 Graphite 标签的支持,用户可以利用 Graphite 插件来增强指标的粒度。使用相关信息(例如应用程序环境或服务类型)标记指标,可以进行更精细的查询和分析,从而使团队能够深入研究特定感兴趣的领域,以获得更好的操作见解。
-
增强的数据清理:利用插件的严格清理选项,用户可以确保其指标名称符合 Graphite 的要求。这种主动措施消除了指标名称中无效字符可能引起的问题,从而实现更清洁的数据管理和更准确的可视化。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它会更有价值。InfluxDB 是排名第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法