目录
强大的性能,无限的扩展
收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它都更有价值。借助 InfluxDB,排名第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法
输入和输出集成概述
AMQP Consumer Input Plugin 允许您从符合 AMQP 0-9-1 标准的消息代理(如 RabbitMQ)中摄取数据,从而实现无缝数据收集,以进行监控和分析。
Loki 插件允许用户将日志发送到 Loki 进行聚合和查询,从而利用 Loki 的高效存储功能。
集成详细信息
AMQP
此插件为 AMQP 0-9-1 提供了一个消费者,RabbitMQ 是其突出的实现。AMQP 或高级消息队列协议最初是为了实现网络中不同系统之间可靠的、可互操作的消息传递而开发的。该插件使用配置的队列和绑定密钥从主题交换中读取指标,从而提供了一种灵活高效的方式来从符合 AMQP 标准的消息传递系统中收集数据。这使用户能够利用现有的 RabbitMQ 实现,通过捕获详细的指标进行分析和告警,从而有效地监控其应用程序。
Loki
此 Loki 插件与 Grafana Loki 集成,Grafana Loki 是一个强大的日志聚合系统。通过以与 Loki 兼容的格式发送日志,此插件可以有效地存储和查询日志。每个日志条目都以键值格式结构化,其中键表示字段名称,值表示相应的日志信息。按时间戳对日志进行排序可确保通过 Loki 查询时,日志流保持时间顺序。此插件对密钥的支持使安全管理身份验证参数变得更容易,而 HTTP 标头、gzip 编码和 TLS 配置的选项增强了日志传输的适应性和安全性,从而满足各种部署需求。
配置
AMQP
[[inputs.amqp_consumer]]
## Brokers to consume from. If multiple brokers are specified a random broker
## will be selected anytime a connection is established. This can be
## helpful for load balancing when not using a dedicated load balancer.
brokers = ["amqp://localhost:5672/influxdb"]
## Authentication credentials for the PLAIN auth_method.
# username = ""
# password = ""
## Name of the exchange to declare. If unset, no exchange will be declared.
exchange = "telegraf"
## Exchange type; common types are "direct", "fanout", "topic", "header", "x-consistent-hash".
# exchange_type = "topic"
## If true, exchange will be passively declared.
# exchange_passive = false
## Exchange durability can be either "transient" or "durable".
# exchange_durability = "durable"
## Additional exchange arguments.
# exchange_arguments = { }
# exchange_arguments = {"hash_property" = "timestamp"}
## AMQP queue name.
queue = "telegraf"
## AMQP queue durability can be "transient" or "durable".
queue_durability = "durable"
## If true, queue will be passively declared.
# queue_passive = false
## Additional arguments when consuming from Queue
# queue_consume_arguments = { }
# queue_consume_arguments = {"x-stream-offset" = "first"}
## A binding between the exchange and queue using this binding key is
## created. If unset, no binding is created.
binding_key = "#"
## Maximum number of messages server should give to the worker.
# prefetch_count = 50
## 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
## Timeout for establishing the connection to a broker
# timeout = "30s"
## Auth method. PLAIN and EXTERNAL are supported
## Using EXTERNAL requires enabling the rabbitmq_auth_mechanism_ssl plugin as
## described here: https://rabbitmq.cn/plugins.html
# auth_method = "PLAIN"
## 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
## Content encoding for message payloads, can be set to
## "gzip", "identity" or "auto"
## - Use "gzip" to decode gzip
## - Use "identity" to apply no encoding
## - Use "auto" determine the encoding using the ContentEncoding header
# content_encoding = "identity"
## Maximum size of decoded message.
## Acceptable units are B, KiB, KB, MiB, MB...
## Without quotes and units, interpreted as size in bytes.
# max_decompression_size = "500MB"
## 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"
Loki
[[outputs.loki]]
## The domain of Loki
domain = "https://loki.domain.tld"
## Endpoint to write api
# endpoint = "/loki/api/v1/push"
## Connection timeout, defaults to "5s" if not set.
# timeout = "5s"
## Basic auth credential
# username = "loki"
# password = "pass"
## Additional HTTP headers
# http_headers = {"X-Scope-OrgID" = "1"}
## If the request must be gzip encoded
# gzip_request = false
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Sanitize Tag Names
## If true, all tag names will have invalid characters replaced with
## underscores that do not match the regex: ^[a-zA-Z_:][a-zA-Z0-9_:]*.
# sanitize_label_names = false
## Metric Name Label
## Label to use for the metric name to when sending metrics. If set to an
## empty string, this will not add the label. This is NOT suggested as there
## is no way to differentiate between multiple metrics.
# metric_name_label = "__name"
输入和输出集成示例
AMQP
-
将应用程序指标与 AMQP 集成:使用 AMQP Consumer 插件收集发布到 RabbitMQ 交换的应用程序指标。通过配置插件以侦听特定队列,团队可以实时了解应用程序性能、跟踪请求速率、错误计数和延迟指标。这种设置不仅有助于异常检测,而且还为容量规划和系统优化提供有价值的数据。
-
事件驱动的监控:每当应用程序中满足某些条件时,配置 AMQP Consumer 以触发特定的监控事件。例如,如果收到指示高错误率的消息,插件可以将此数据馈送到监控工具中,从而生成警报或扩展事件。这种集成可以提高对问题的响应速度,并自动化部分操作工作流程。
-
跨平台数据聚合:利用 AMQP Consumer 插件来整合来自分布在不同平台上的各种应用程序的指标。通过利用 RabbitMQ 作为集中式消息代理,组织可以统一其监控数据,从而通过 Telegraf 进行全面的分析和仪表板展示,从而在异构环境中保持可见性。
-
实时日志处理:扩展 AMQP Consumer 的使用范围,以捕获发送到 RabbitMQ 交换的日志数据,实时处理日志以进行监控和告警。此应用程序确保通过分析日志模式、趋势和异常情况(在发生时),可以快速检测和解决操作问题。
Loki
-
微服务的集中式日志记录:利用 Loki 插件收集来自 Kubernetes 集群中运行的多个微服务的日志。通过将日志定向到集中的 Loki 实例,开发人员可以在一个位置监控、搜索和分析来自所有服务的日志,从而更轻松地进行故障排除和性能监控。这种设置简化了操作,并支持对分布式应用程序中的问题做出快速响应。
-
实时日志异常检测:将 Loki 与监控工具结合使用,以实时分析日志输出中可能表明系统错误或安全威胁的异常模式。在日志流上实施异常检测使团队能够主动识别和响应事件,从而提高系统可靠性并增强安全态势。
-
通过 Gzip 压缩增强日志处理:配置 Loki 插件以使用 gzip 压缩进行日志传输。这种方法可以减少带宽使用并提高传输速度,这在网络带宽可能受限的环境中尤其有益。它对于高容量日志记录应用程序尤其有用,在这些应用程序中,每个字节都很重要,并且性能至关重要。
-
通过自定义标头支持多租户:利用添加自定义 HTTP 标头的功能,在多租户应用程序环境中隔离来自不同租户的日志。通过使用 Loki 插件为每个租户发送不同的标头,运营商可以确保正确的日志管理并符合数据隔离要求,使其成为 SaaS 应用程序的通用解决方案。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。
强大的性能,无限的扩展
收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它都更有价值。借助 InfluxDB,排名第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法