问题
I'm setting up monitoring for Kafka connect in our Kafka ecosystem. I have enabled JMX exporter for kafka brokers and is working fine. Now I am trying to enable JMX exporter for kafka connect. However, it is a bit unclear where to start.
I can only modify connect-distributed.sh
to enable the change. Any pointers would be a great addition.
kafka-run-class.sh
was modified to enable jmx_exporter
to emit jmx metrics on http://<host>:9304/metrics
I expect kafka-connect to emit metrics on http://<host>:19000/metrics
once the jmx_exporter
has been enabled.
回答1:
Digging around I have found a solution to the issue. Java agent can be added to the connect-distributed.sh
and starts to emit the metrics nicely.
So enable jmx_exporter
on Kafka Connect framework
- Open
connect-distributed.sh
- Modify the last line which calls the
kafka-run-class.sh
exec $(dirname $0)/kafka-run-class.sh $EXTRA_ARGS org.apache.kafka.connect.cli.ConnectDistributed "$@"
to the following
exec $(dirname $0)/kafka-run-class.sh $EXTRA_ARGS -javaagent:/path/to/jmx_prometheus_javaagent-0.11.0.jar=9408:/path/to/config/file/prometheus.yml org.apache.kafka.connect.cli.ConnectDistributed "$@"
来源:https://stackoverflow.com/questions/56835399/is-there-a-way-to-configure-kafka-connect-jmx-metrics-to-be-captured-using-a-jmx