菜单
文档breadcrumb arrow Grafana Alloybreadcrumb arrow 参考breadcrumb arrow 组件breadcrumb arrow prometheusbreadcrumb arrow prometheus.exporter.kafka
开源

prometheus.exporter.kafka

prometheus.exporter.kafka 组件集成了 kafka_exporter 以收集来自 Kafka 服务器的度量信息。

用法

alloy
prometheus.exporter.kafka "LABEL" {
    kafka_uris = KAFKA_URI_LIST
}

参数

您可以使用以下参数来配置导出器的行为。省略的字段将采用其默认值。

名称类型描述默认值必需
kafka_urisarray(string)Address array (host:port) of Kafka server.yes
instancestringThe instance label for metrics, default is the hostname:port of the first kafka_uris. You must manually provide the instance value if there is more than one string in kafka_uris.no
use_saslboolConnect using SASL/PLAIN.no
use_sasl_handshakeboolOnly set this to false if using a non-Kafka SASL proxy.trueno
sasl_usernamestringSASL user name.no
sasl_passwordstringSASL user password.no
sasl_mechanismstringThe SASL SCRAM SHA algorithm sha256 or sha512 as mechanism.no
sasl_disable_pafx_fastboolConfigure the Kerberos client to not use PA_FX_FAST.no
use_tlsboolConnect using TLS.no
tls_server_namestringUsed to verify the hostname on the returned certificates unless tls.insecure-skip-tls-verify is given. If you don’t provide the Kafka server name, the hostname is taken from the URL.no
ca_filestringThe optional certificate authority file for TLS client authentication.no
cert_filestringThe optional certificate file for TLS client authentication.no
key_filestringThe optional key file for TLS client authentication.no
insecure_skip_verifyboolIf set to true, the server’s certificate will not be checked for validity. This makes your HTTPS connections insecure.no
kafka_versionstringKafka broker version.2.0.0no
use_zookeeper_lagboolIf set to true, use a group from zookeeper.no
zookeeper_urisarray(string)Address array (hosts) of zookeeper server.no
kafka_cluster_namestringKafka cluster name.no
metadata_refresh_intervaldurationMetadata refresh interval.1mno
gssapi_service_namestringService name when using Kerberos Authorizationno
gssapi_kerberos_config_pathstringKerberos config path.no
gssapi_realmstringKerberos realm.no
gssapi_key_tab_pathstringKerberos keytab file path.no
gssapi_kerberos_auth_typestringKerberos auth type.Either ‘keytabAuth’ or ‘userAuth’.no
offset_show_allboolIf true, the broker may auto-create topics that we requested which do not already exist.trueno
topic_workersintMinimum number of topics to monitor.100no
allow_concurrencyboolIf set to true, all scrapes trigger Kafka operations. Otherwise, they will share results. WARNING: Disable this on large clusters.trueno
allow_auto_topic_creationboolIf true, the broker may auto-create topics that we requested which do not already exist.no
max_offsetsint存储到分区的插值表中最大偏移数量。1000no
prune_interval_secondsint已废弃(无操作),请使用 metadata_refresh_interval 代替。30no
topics_filter_regexstring用于监控主题的正则表达式过滤器。.*no
topics_exclude_regexstring确定要排除的主题的正则表达式。^$no
groups_filter_regexstring用于监控消费者组的正则表达式过滤器。.*no
groups_exclude_regexstring用于确定要排除的消费者组的正则表达式。^$no

导出字段

以下字段被导出,可以被其他组件引用。

名称类型描述
targets列表(map(string))可以用于收集导出度量值的目标。

例如,targets 可以传递给 discovery.relabel 组件以重写目标的标签集,或者传递给收集公开度量的 prometheus.scrape 组件。

导出的目标使用由 运行命令 指定的配置 内存流量 地址。

组件健康

prometheus.exporter.kafka 只有在提供无效配置时才会报告为不健康。在这些情况下,导出的字段保留其最后健康值。

调试信息

prometheus.exporter.kafka 不公开任何特定组件的调试信息。

调试度量

prometheus.exporter.kafka 不公开任何特定组件的调试度量。

示例

此示例使用 prometheus.scrape 组件prometheus.exporter.kafka 收集度量值

alloy
prometheus.exporter.kafka "example" {
  kafka_uris = ["localhost:9200"]
}

// Configure a prometheus.scrape component to send metrics to.
prometheus.scrape "demo" {
  targets    = prometheus.exporter.kafka.example.targets
  forward_to = [prometheus.remote_write.demo.receiver]
}

prometheus.remote_write "demo" {
  endpoint {
    url = PROMETHEUS_REMOTE_WRITE_URL

    basic_auth {
      username = USERNAME
      password = PASSWORD
    }
  }
}

替换以下内容

  • PROMETHEUS_REMOTE_WRITE_URL:发送度量值的服务器兼容 Prometheus remote_write 的 URL。
  • USERNAME:用于远程_write API 认证的用户名。
  • PASSWORD:用于远程_write API 认证的密码。

兼容组件

prometheus.exporter.kafka 的导出可以被以下组件接收

注意

连接某些组件可能不合理,或者组件可能需要进一步配置才能正确连接。有关详细信息,请参阅相关文档。