danielqsj / kafka_exporter

Kafka exporter for Prometheus
Apache License 2.0
2.09k stars 602 forks source link

can get 'kafka_consumergroup_members',but can't get 'kafka_topic_partition_current_offset' and 'kafka_topic_partition_current_lag' #434

Closed JokerShaco0319 closed 2 months ago

JokerShaco0319 commented 3 months ago

hare is my version info: kafka-exporter : 1.7.0 kafka: 3.5.2 zk: 3.7.2 run Env: Linux VM-4-9-centos 3.10.0-1160.99.1.el7.x86_64 Lunch Script:./kafka_exporter --kafka.server=${KAFKA_NODE} --kafka.version=3.5.2 --group.filter='.+' --use.consumelag.zookeeper --zookeeper.server=${ZK_CLUSTER} --log.level=debug >> ${LOG_FILE} --web.listen-address=0.0.0.0:9011 2>&1 & above, k and kafka connection is OK, but the metrics about of consumer group I just get 'kafka_consumergroup_members', just like the next image. image I think this problem origin beacuse is version not match. I will test,but ,could give me a list of zk, kafka and kafka_exporter's relations about version match

JokerShaco0319 commented 2 months ago

​ The problem has been solved, not the version mismatch. The problem is in the consumer's creation command. When a production topic is created, the corresponding consumer needs to be assigned a corresponding consumption group. Otherwise, the consumer's related information cannot be normally obtained. The consumer related indicators can be obtained through the following command

  1. create a new producter topic

    ./bin/kafka-console-producer.sh --broker-list 127.0.0.1:9091 --topic youtopic
  2. create a new consumer with topic and group

    ./bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9091 --topic youtopic --group your-group

​ then you can get metrics about consumer. image