jmx\u prometheus\u kafka connect的javaagent配置?

tjjdgumg  于 2021-06-06  发布在  Kafka
关注(0)|答案(2)|浏览(358)

普罗米修斯jmxèu出口商项目给出了Kafka的官方配置示例:
https://github.com/prometheus/jmx_exporter/blob/master/example_configs/kafka-0-8-2.yml
kafka connect是否有类似的配置来将kafka connect jmx度量导出到prometheus?

syqv5f0l

syqv5f0l1#

我在找同样的东西,在下面找到了。希望有帮助:)
https://raw.githubusercontent.com/zenreach/docker-kafka-connect/master/jmx_exporter.yaml

lowercaseOutputName: true
rules:
  - pattern: kafka.connect<type=connect-node-metrics, client-id=(.+), node-id=(.+)><>([a-z-]+)
    name: kafka_connect_node_$3
    labels:
      clientId: "$1"
      nodeId: "$2"
  - pattern: kafka.connect<type=connect-coordinator-metrics, client-id=(.+)><>([a-z-]+)thu
    name: kafka_connect_coordinator_$2
    labels:
      clientId: "$1"
  - pattern: kafka.consumer<type=consumer-node-metrics, client-id=(.+), node-id=(.+)><>([a-z-]+)
    name: kafka_connect_consumer_node_$3
    labels:
      clientId: "$1"
      nodeId: "$2"
  - pattern: kafka.consumer<type=consumer-fetch-manager-metrics, client-id=(.+), topic=(.+)><>([a-z-]+)
    name: kafka_connect_consumer_fetch_manager_$3
    labels:
      clientId: "$1"
      topic: "$2"
  - pattern: kafka.producer<type=producer-topic-metrics, client-id=(.+), topic=(.+)><>([a-z-]+)
    name: kafka_connect_producer_topic_$3
    labels:
      clientId: "$1"
      topic: "$2"
  - pattern: kafka.producer<type=producer-node-metrics, client-id=(.+), node-id=(.+)><>([a-z-]+)
    name: kafka_connect_producer_node_$3
    labels:
      clientId: "$1"
      nodeId: "$2"
slsn1g29

slsn1g292#

我目前使用的解决方案是官方合流 Helm 图表和docker图像,其中内置了普罗米修斯公制输出:
https://github.com/confluentinc/cp-helm-charts/tree/master/charts/cp-kafka-connect
作为参考,如果您想要一个非docker、非kubernetes的解决方案,那么以前的一种100%有效的方法如下:
1) 定义此文件 kafka-connect-jmx.yaml . 我正在将此配置文件存储在 /usr/share/ ,可以将其放在其他位置,但需要更改下面的路径引用。

whitelistObjectNames: ["kafka.connect:*"]
lowercaseOutputName: false
lowercaseOutputLabelNames: false

rules:
  - pattern: 'status: running'
    value: 1
  - pattern: 'status: *'
    value: 0
  - pattern: ".*"

2) 下载 https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.12.0/jmx_prometheus_javaagent-0.12.0.jar . 我把它放进去了 /usr/share/ ,可以将其放在其他位置,但需要在步骤3中更新路径。
3) 当你运行Kafka连接 connect-distributed 确保已设置此环境变量,并且路径与步骤1+2中使用的路径匹配

KAFKA_OPTS=-javaagent:/usr/share/jmx_prometheus_javaagent-0.12.0.jar=7072:/usr/share/kafka-connect-jmx.yaml

相关问题