I’ve now added the jmx exporter to one broker, and it seems to work, i see the startup info on broker start.
However when running kafka-topics inside to recreate the test topic (or bascially when running any command) it seesm to try to start the Exporter again despite it still running?
I’m using your config basically…
sh-4.4$ ./kafka-topics \
> --create \
> --topic perf-test \
> --partitions 16 \
> --replication-factor 3 \
> --config retention.ms=86400000 \
> --config min.insync.replicas=2 \
> --bootstrap-server host0:9094,host1:9094,host2:9094
2025-02-11 12:05:59.503 | main | INFO | io.prometheus.jmx.JavaAgent | Starting ...
2025-02-11 12:05:59.693 | main | INFO | io.prometheus.jmx.JavaAgent | HTTP enabled [true]
2025-02-11 12:05:59.694 | main | INFO | io.prometheus.jmx.JavaAgent | HTTP host:port [0.0.0.0:8091]
2025-02-11 12:05:59.694 | main | INFO | io.prometheus.jmx.JavaAgent | OpenTelemetry enabled [false]
Failed to start Prometheus JMX Exporter ...
java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at jdk.httpserver/sun.net.httpserver.ServerImpl.<init>(Unknown Source)
at jdk.httpserver/sun.net.httpserver.HttpServerImpl.<init>(Unknown Source)
at jdk.httpserver/sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(Unknown Source)
at jdk.httpserver/com.sun.net.httpserver.HttpServer.create(Unknown Source)
at io.prometheus.metrics.exporter.httpserver.HTTPServer$Builder.buildAndStart(HTTPServer.java:263)
at io.prometheus.jmx.common.http.HTTPServerFactory.createHTTPServer(HTTPServerFactory.java:125)
at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:84)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Prometheus JMX Exporter exiting
sh-4.4$ ./kafka-topics --list --bootstrap-server host0:9094,host1:9094,host2:9094
2025-02-11 12:06:37.464 | main | INFO | io.prometheus.jmx.JavaAgent | Starting ...
2025-02-11 12:06:37.653 | main | INFO | io.prometheus.jmx.JavaAgent | HTTP enabled [true]
2025-02-11 12:06:37.653 | main | INFO | io.prometheus.jmx.JavaAgent | HTTP host:port [0.0.0.0:8091]
2025-02-11 12:06:37.653 | main | INFO | io.prometheus.jmx.JavaAgent | OpenTelemetry enabled [false]
Failed to start Prometheus JMX Exporter ...
java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at jdk.httpserver/sun.net.httpserver.ServerImpl.<init>(Unknown Source)
at jdk.httpserver/sun.net.httpserver.HttpServerImpl.<init>(Unknown Source)
at jdk.httpserver/sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(Unknown Source)
at jdk.httpserver/com.sun.net.httpserver.HttpServer.create(Unknown Source)
at io.prometheus.metrics.exporter.httpserver.HTTPServer$Builder.buildAndStart(HTTPServer.java:263)
at io.prometheus.jmx.common.http.HTTPServerFactory.createHTTPServer(HTTPServerFactory.java:125)
at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:84)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Prometheus JMX Exporter exiting
Also it does not seem to exec the actual command maybe due to the error? (ie no new topic created, not all topics listed)?
Also, is there a Grafana dashboard related to your kafka_yaml.file?
I found one at Grafana’s but thats outdated (Angular) and using different metrics.
I can adjust o/c but if there is a mathcing version that you know off…
(Edit - removed the solved marker so this wont close on us while there are still things to discuss - or me ask you about:p)
The Kafka_opt is the one which actually provides data, and JMX Port is used to activate JMX in the first place normally ö-
do I really need both? Or will using the Opts in this way automatically activate JMX without me specifically setting the port?