RabbitMQ 和 Elasticsearch 集成

通过 Telegraf(由 InfluxData 构建的开源数据连接器)提供支持,实现强大的性能和简单的集成。

info

对于大规模实时查询,这不是推荐的配置。为了进行查询和压缩优化、高速摄取和高可用性,您可能需要考虑RabbitMQ 和 InfluxDB

50 亿+

Telegraf 下载量

#1

时间序列数据库
来源:DB Engines

10 亿+

InfluxDB 下载量

2,800+

贡献者

目录

强大的性能,无限的扩展性

收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它都会变得更有价值。借助 InfluxDB,这是排名第一的时间序列平台,旨在与 Telegraf 一起扩展。

查看入门方法

输入和输出集成概述

此插件从 RabbitMQ 服务器读取指标,提供对消息传递系统的性能和状态的重要见解。

Telegraf Elasticsearch 插件无缝地将指标发送到 Elasticsearch 服务器。该插件处理模板创建和动态索引管理,并支持各种 Elasticsearch 特有功能,以确保数据格式正确以便存储和检索。

集成详情

RabbitMQ

Telegraf 的 RabbitMQ 插件允许用户通过 RabbitMQ 管理插件从 RabbitMQ 服务器收集指标。此功能对于监控 RabbitMQ 实例的性能和健康状况至关重要,RabbitMQ 实例广泛用于各种应用程序中的消息队列和处理。该插件提供对关键 RabbitMQ 指标的全面洞察,包括消息速率、队列深度和节点健康统计信息,从而使运营商能够保持其消息传递基础设施的最佳性能和稳健性。此外,它还支持用于安全管理敏感凭据的密钥存储,从而使与现有系统的集成更加顺畅。配置选项允许灵活地指定要监控的节点、队列和交换机,为各种部署场景提供有价值的适应性。

Elasticsearch

此插件将指标写入 Elasticsearch,Elasticsearch 是一个分布式 RESTful 搜索和分析引擎,能够近乎实时地存储大量数据。它旨在处理 Elasticsearch 5.x 到 7.x 版本,并利用其动态模板功能来正确管理数据类型映射。该插件支持高级功能,例如模板管理、动态索引命名以及与 OpenSearch 的集成。它还允许配置 Elasticsearch 节点的身份验证和健康状况监控。

配置

RabbitMQ

[[inputs.rabbitmq]]
  ## Management Plugin url. (default: http://localhost:15672)
  # url = "http://localhost:15672"
  ## Tag added to rabbitmq_overview series; deprecated: use tags
  # name = "rmq-server-1"
  ## Credentials
  # username = "guest"
  # password = "guest"

  ## 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

  ## Optional request timeouts
  ## ResponseHeaderTimeout, if non-zero, specifies the amount of time to wait
  ## for a server's response headers after fully writing the request.
  # header_timeout = "3s"
  ##
  ## client_timeout specifies a time limit for requests made by this client.
  ## Includes connection time, any redirects, and reading the response body.
  # client_timeout = "4s"

  ## A list of nodes to gather as the rabbitmq_node measurement. If not
  ## specified, metrics for all nodes are gathered.
  # nodes = ["rabbit@node1", "rabbit@node2"]

  ## A list of queues to gather as the rabbitmq_queue measurement. If not
  ## specified, metrics for all queues are gathered.
  ## Deprecated in 1.6: Use queue_name_include instead.
  # queues = ["telegraf"]

  ## A list of exchanges to gather as the rabbitmq_exchange measurement. If not
  ## specified, metrics for all exchanges are gathered.
  # exchanges = ["telegraf"]

  ## Metrics to include and exclude. Globs accepted.
  ## Note that an empty array for both will include all metrics
  ## Currently the following metrics are supported: "exchange", "federation", "node", "overview", "queue"
  # metric_include = []
  # metric_exclude = []

  ## Queues to include and exclude. Globs accepted.
  ## Note that an empty array for both will include all queues
  # queue_name_include = []
  # queue_name_exclude = []

  ## Federation upstreams to include and exclude specified as an array of glob
  ## pattern strings.  Federation links can also be limited by the queue and
  ## exchange filters.
  # federation_upstream_include = []
  # federation_upstream_exclude = []

Elasticsearch


[[outputs.elasticsearch]]
  ## The full HTTP endpoint URL for your Elasticsearch instance
  ## Multiple urls can be specified as part of the same cluster,
  ## this means that only ONE of the urls will be written to each interval
  urls = [ "http://node1.es.example.com:9200" ] # required.
  ## Elasticsearch client timeout, defaults to "5s" if not set.
  timeout = "5s"
  ## Set to true to ask Elasticsearch a list of all cluster nodes,
  ## thus it is not necessary to list all nodes in the urls config option
  enable_sniffer = false
  ## Set to true to enable gzip compression
  enable_gzip = false
  ## Set the interval to check if the Elasticsearch nodes are available
  ## Setting to "0s" will disable the health check (not recommended in production)
  health_check_interval = "10s"
  ## Set the timeout for periodic health checks.
  # health_check_timeout = "1s"
  ## HTTP basic authentication details.
  ## HTTP basic authentication details
  # username = "telegraf"
  # password = "mypassword"
  ## HTTP bearer token authentication details
  # auth_bearer_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"

  ## Index Config
  ## The target index for metrics (Elasticsearch will create if it not exists).
  ## You can use the date specifiers below to create indexes per time frame.
  ## The metric timestamp will be used to decide the destination index name
  # %Y - year (2016)
  # %y - last two digits of year (00..99)
  # %m - month (01..12)
  # %d - day of month (e.g., 01)
  # %H - hour (00..23)
  # %V - week of the year (ISO week) (01..53)
  ## Additionally, you can specify a tag name using the notation {{tag_name}}
  ## which will be used as part of the index name. If the tag does not exist,
  ## the default tag value will be used.
  # index_name = "telegraf-{{host}}-%Y.%m.%d"
  # default_tag_value = "none"
  index_name = "telegraf-%Y.%m.%d" # required.

  ## Optional Index Config
  ## Set to true if Telegraf should use the "create" OpType while indexing
  # use_optype_create = 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

  ## Template Config
  ## Set to true if you want telegraf to manage its index template.
  ## If enabled it will create a recommended index template for telegraf indexes
  manage_template = true
  ## The template name used for telegraf indexes
  template_name = "telegraf"
  ## Set to true if you want telegraf to overwrite an existing template
  overwrite_template = false
  ## If set to true a unique ID hash will be sent as sha256(concat(timestamp,measurement,series-hash)) string
  ## it will enable data resend and update metric points avoiding duplicated metrics with different id's
  force_document_id = false

  ## Specifies the handling of NaN and Inf values.
  ## This option can have the following values:
  ##    none    -- do not modify field-values (default); will produce an error if NaNs or infs are encountered
  ##    drop    -- drop fields containing NaNs or infs
  ##    replace -- replace with the value in "float_replacement_value" (default: 0.0)
  ##               NaNs and inf will be replaced with the given number, -inf with the negative of that number
  # float_handling = "none"
  # float_replacement_value = 0.0

  ## Pipeline Config
  ## To use a ingest pipeline, set this to the name of the pipeline you want to use.
  # use_pipeline = "my_pipeline"
  ## Additionally, you can specify a tag name using the notation {{tag_name}}
  ## which will be used as part of the pipeline name. If the tag does not exist,
  ## the default pipeline will be used as the pipeline. If no default pipeline is set,
  ## no pipeline is used for the metric.
  # use_pipeline = "{{es_pipeline}}"
  # default_pipeline = "my_pipeline"
  #
  # Custom HTTP headers
  # To pass custom HTTP headers please define it in a given below section
  # [outputs.elasticsearch.headers]
  #    "X-Custom-Header" = "custom-value"

  ## Template Index Settings
  ## Overrides the template settings.index section with any provided options.
  ## Defaults provided here in the config
  # template_index_settings = {
  #   refresh_interval = "10s",
  #   mapping.total_fields.limit = 5000,
  #   auto_expand_replicas = "0-1",
  #   codec = "best_compression"
  # }

输入和输出集成示例

RabbitMQ

  1. 监控队列性能指标:使用 RabbitMQ 插件来跟踪队列性能随时间的变化。这包括设置监控仪表板,以可视化关键队列指标,例如消息速率、消费者数量和消息传递速率。通过这些信息,团队可以通过分析趋势并根据数据做出关于扩展或优化其 RabbitMQ 配置的明智决策,从而主动解决任何瓶颈或性能问题。

  2. 系统健康状况警报:将 RabbitMQ 插件与警报系统集成,以将 RabbitMQ 实例中潜在的问题通知运营团队。例如,如果未确认消息的数量达到临界阈值,或者队列变得不堪重负,则可以触发警报,从而可以立即进行调查并迅速采取补救措施,以维护消息流的健康状况。

  3. 分析消息处理指标:使用该插件收集有关消息处理性能的详细指标,例如已发布、已确认和已重新传递的消息速率。通过分析这些指标,团队可以评估其消息消费者应用程序的效率,并在必要时调整配置或代码,从而提高整体系统吞吐量和弹性。

  4. 跨系统数据集成:利用 RabbitMQ 插件收集的指标来集成 RabbitMQ 和其他系统或服务之间的数据流。例如,使用收集的指标来驱动自动化工作流程或分析管道,这些管道利用在 RabbitMQ 中处理的消息,使组织能够优化工作流程并提高其生态系统中的数据敏捷性。

Elasticsearch

  1. 基于时间的索引:使用此插件将指标存储在 Elasticsearch 中,以根据收集时间为每个指标编制索引。例如,CPU 指标可以存储在名为 telegraf-2023.01.01 的每日索引中,从而可以轻松进行基于时间的查询和保留策略。

  2. 动态模板管理:利用模板管理功能自动创建针对您的指标量身定制的自定义模板。这使您可以定义如何索引和分析不同的字段,而无需手动配置 Elasticsearch,从而确保用于查询的最佳数据结构。

  3. OpenSearch 兼容性:如果您正在使用 AWS OpenSearch,则可以通过激活兼容模式来配置此插件以无缝工作,从而确保您现有的 Elasticsearch 客户端保持功能正常,并与较新的集群设置兼容。

反馈

感谢您成为我们社区的一份子!如果您有任何一般反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。

强大的性能,无限的扩展性

收集、组织和处理海量高速数据。当您将任何数据视为时间序列数据时,它都会变得更有价值。借助 InfluxDB,这是排名第一的时间序列平台,旨在与 Telegraf 一起扩展。

查看入门方法

相关集成

HTTP 和 InfluxDB 集成

HTTP 插件从一个或多个 HTTP(S) 端点收集指标。它支持各种身份验证方法和数据格式的配置选项。

查看集成

Kafka 和 InfluxDB 集成

此插件从 Kafka 读取消息,并允许基于这些消息创建指标。它支持各种配置,包括不同的 Kafka 设置和消息处理选项。

查看集成

Kinesis 和 InfluxDB 集成

Kinesis 插件允许从 AWS Kinesis 流中读取指标。它支持多种输入数据格式,并为可靠的消息处理提供带有 DynamoDB 的检查点功能。

查看集成