目录
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它都会更有价值。使用 InfluxDB,这是第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法
输入和输出集成概述
AMQP Consumer 输入插件允许您从符合 AMQP 0-9-1 标准的消息代理(例如 RabbitMQ)摄取数据,从而实现无缝数据收集,以进行监控和分析。
MongoDB Telegraf 插件使用户能够将指标发送到 MongoDB 数据库,自动管理时间序列集合。
集成详情
AMQP
此插件为 AMQP 0-9-1 提供了一个消费者,RabbitMQ 是其一个突出的实现。AMQP 或高级消息队列协议最初是为了在网络中不同的系统之间实现可靠的、可互操作的消息传递而开发的。该插件使用配置的队列和绑定键从主题交换中读取指标,从而提供了一种灵活高效的方式来从符合 AMQP 标准的消息传递系统中收集数据。这使用户能够利用现有的 RabbitMQ 实现,通过捕获详细的指标进行分析和警报,从而有效地监控其应用程序。
MongoDB
此插件将指标发送到 MongoDB,并与其时间序列功能无缝集成,从而允许在时间序列集合尚不存在时自动创建为时间序列集合。它需要 MongoDB 5.0 或更高版本才能使用时间序列集合功能,这对于有效存储和查询基于时间的数据至关重要。此插件通过确保所有相关的指标都正确地存储和组织在 MongoDB 中,从而增强了监控功能,使用户能够利用 MongoDB 强大的查询和聚合功能进行时间序列分析。
配置
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://: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"
MongoDB
[[outputs.mongodb]]
              # connection string examples for mongodb
              dsn = "mongodb://:27017"
              # dsn = "mongodb://mongod1:27017,mongod2:27017,mongod3:27017/admin&replicaSet=myReplSet&w=1"
              # overrides serverSelectionTimeoutMS in dsn if set
              # timeout = "30s"
              # default authentication, optional
              # authentication = "NONE"
              # for SCRAM-SHA-256 authentication
              # authentication = "SCRAM"
              # username = "root"
              # password = "***"
              # for x509 certificate authentication
              # authentication = "X509"
              # tls_ca = "ca.pem"
              # tls_key = "client.pem"
              # # tls_key_pwd = "changeme" # required for encrypted tls_key
              # insecure_skip_verify = false
              # database to store measurements and time series collections
              # database = "telegraf"
              # granularity can be seconds, minutes, or hours.
              # configuring this value will be based on your input collection frequency.
              # see https://docs.mongodb.com/manual/core/timeseries-collections/#create-a-time-series-collection
              # granularity = "seconds"
              # optionally set a TTL to automatically expire documents from the measurement collections.
              # ttl = "360h"
输入和输出集成示例
AMQP
- 
    将应用程序指标与 AMQP 集成:使用 AMQP Consumer 插件来收集发布到 RabbitMQ 交换的应用程序指标。通过配置插件以侦听特定队列,团队可以深入了解应用程序性能,实时跟踪请求率、错误计数和延迟指标。这种设置不仅有助于异常检测,而且还为容量规划和系统优化提供了有价值的数据。 
- 
    事件驱动监控:配置 AMQP Consumer 以在应用程序中满足特定条件时触发特定的监控事件。例如,如果收到指示高错误率的消息,则插件可以将此数据馈送到监控工具中,生成警报或扩展事件。这种集成可以提高对问题的响应能力,并自动化部分操作工作流程。 
- 
    跨平台数据聚合:利用 AMQP Consumer 插件来整合来自分布在不同平台上的各种应用程序的指标。通过使用 RabbitMQ 作为集中式消息代理,组织可以统一其监控数据,从而可以通过 Telegraf 进行全面的分析和仪表板,从而在异构环境中保持可见性。 
- 
    实时日志处理:扩展 AMQP Consumer 的使用,以捕获发送到 RabbitMQ 交换的日志数据,实时处理日志以进行监控和警报。此应用程序通过分析日志模式、趋势和异常情况(在发生时),确保快速检测和解决操作问题。 
MongoDB
- 
    针对物联网设备的 MongoDB 动态日志记录:使用此插件实时收集和存储来自大量物联网设备的指标。通过将设备日志直接发送到 MongoDB,您可以创建一个集中式数据库,从而可以轻松访问和查询运行状况指标和性能数据,从而能够根据历史趋势进行主动维护和故障排除。 
- 
    Web 流量的时间序列分析:使用 MongoDB Telegraf 插件来收集和分析随时间推移的 Web 流量指标。此应用程序可以帮助您了解高峰使用时间、用户交互和行为模式,从而指导营销策略和基础设施扩展决策,以改善用户体验。 
- 
    自动化监控和警报系统:将 MongoDB 插件集成到跟踪应用程序性能指标的自动化监控系统中。借助时间序列集合,您可以根据特定阈值设置警报,使您的团队能够在潜在问题影响用户之前做出响应。这种主动管理可以提高服务可靠性和整体性能。 
- 
    指标存储中的数据保留和 TTL 管理:利用 MongoDB 集合中文档的 TTL 功能来自动过期过时的指标。这对于仅相关最近的性能数据的环境尤其有用,从而防止 MongoDB 数据库因旧指标而变得混乱,并确保高效的数据管理。 
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它都会更有价值。使用 InfluxDB,这是第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法