<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Configure JMX Exporter (java agent) for Kafka - CDP Private Base 7.1.9 in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Configure-JMX-Exporter-java-agent-for-Kafka-CDP-Private-Base/m-p/401400#M251136</link>
    <description>&lt;P&gt;For the benefit of anyone if looking for a solution to this. We need to add the -javaagent parameter in "&lt;SPAN&gt;Additional Broker Java Options" configuration property instead of what mentioned in in the post.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Feb 2025 09:48:44 GMT</pubDate>
    <dc:creator>snm1523</dc:creator>
    <dc:date>2025-02-03T09:48:44Z</dc:date>
    <item>
      <title>Configure JMX Exporter (java agent) for Kafka - CDP Private Base 7.1.9</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Configure-JMX-Exporter-java-agent-for-Kafka-CDP-Private-Base/m-p/401119#M251075</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have got a JXM exporter configured for Kafka brokers to send metrics to prometheus which allows me to monitor Kafka via Grafana Dashboards. All is working okay, however, stuck with a weird issue.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Backaground:&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;JMX exporter is configured using below property for Kafka brokers:&lt;BR /&gt;in&amp;nbsp;&lt;STRONG&gt;Kafka Broker Environment Advanced Configuration Snippet (Safety Valve)&lt;/STRONG&gt; have added a key&amp;nbsp;&lt;STRONG&gt;KAFKA_JMX_OPTS&amp;nbsp;&lt;/STRONG&gt;and its value as&amp;nbsp;&lt;STRONG&gt;-javaagent:/var/lib/prometheus_jmx_config/jmx_prometheus_javaagent-0.20.0.jar=9091:/var/lib/prometheus_jmx_config/kafka_jmx_exporter.yml.&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;The jar and yml files provided in the configuration are in place and all works okay. We are able to get required metrics to Grafana via Prometheus.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Issue:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/U&gt;Whenever we attempt to restart Kafka brokers, it does happily, however, when attempted a rolling restart it fails with below error in stderr log file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;+ [[ healthy partitions stay healthy == *\p\a\r\t\i\t\i\o\n\s\ \s\t\a\y\ \h\e\a\l\t\h\y* ]]
+ call_kafka_topics --at-min-isr-partitions
+ option=--at-min-isr-partitions
+ get_property bootstrap.servers /var/run/cloudera-scm-agent/process/18315-kafka-KAFKA_BROKER-kafka_broker_rolling_restart_pre_check/rolling_restart_check_before_stop_admin_client_configs.properties BOOTSTRAP_SERVERS
++ dirname /opt/cloudera/cm-agent/service/common/cloudera-config.sh
+ GET_PROPERTY_PY_DIR=/opt/cloudera/cm-agent/service/common
++ python -u /opt/cloudera/cm-agent/service/common/get_property.py bootstrap.servers /var/run/cloudera-scm-agent/process/18315-kafka-KAFKA_BROKER-kafka_broker_rolling_restart_pre_check/rolling_restart_check_before_stop_admin_client_configs.properties
+ value=
+ eval 'BOOTSTRAP_SERVERS='\'''\'''
++ BOOTSTRAP_SERVERS=
+ [[ -z '' ]]
+ BOOTSTRAP_SERVERS=&amp;lt;broker&amp;gt;:6667
+ kafka-topics --at-min-isr-partitions --describe --bootstrap-server &amp;lt;broker&amp;gt;:6667 --command-config /var/run/cloudera-scm-agent/process/18315-kafka-KAFKA_BROKER-kafka_broker_rolling_restart_pre_check/rolling_restart_check_before_stop_admin_client_configs.properties
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: 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(Net.java:459)
        at java.base/sun.nio.ch.Net.bind(Net.java:448)
        at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
        at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
        at jdk.httpserver/sun.net.httpserver.ServerImpl.&amp;lt;init&amp;gt;(ServerImpl.java:142)
        at jdk.httpserver/sun.net.httpserver.HttpServerImpl.&amp;lt;init&amp;gt;(HttpServerImpl.java:50)
        at jdk.httpserver/sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35)
        at jdk.httpserver/com.sun.net.httpserver.HttpServer.create(HttpServer.java:137)
        at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer$Builder.build(HTTPServer.java:365)
        at io.prometheus.jmx.common.http.HTTPServerFactory.createHTTPServer(HTTPServerFactory.java:123)
        at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:60)
        ... 6 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at ./src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
/var/run/cloudera-scm-agent/process/18315-kafka-KAFKA_BROKER-kafka_broker_rolling_restart_pre_check/scripts/broker_rolling_restart_checker.sh: line 63: 24738 Aborted                 kafka-topics ${option} --describe --bootstrap-server "${BOOTSTRAP_SERVERS}" --command-config "${prop_file}" &amp;gt;&amp;gt; "${describe_partitions_output}"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per my understanding, the error indicates that a port is already being used while doing the health checks of Kafka topics. I assume it is complaining about 6667 since there is not clear mention of which port is an issue. However, rolling restart without this configuration just works fine. So confused if it is really the failure of Kafka-topics health check?&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Diagnosis / troubleshooting /&lt;/STRONG&gt;&lt;STRONG&gt; findings:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When we do a full restart of kafka brokers with this configuration in place, it works okay, only the rolling restart fails.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;LI&gt;We tried below Cloudera articles, however, no luck:&lt;BR /&gt;&lt;A href="https://my.cloudera.com/knowledge/How-to-configure-JMX-access-for-Kafka-in-CDP?id=390204" target="_blank" rel="noopener"&gt;https://my.cloudera.com/knowledge/How-to-configure-JMX-access-for-Kafka-in-CDP?id=390204&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;Since we are on a non-SSL cluster, below was the configuration tried while following the first link:&lt;BR /&gt;&lt;EM&gt;-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:G1HeapRegionSize=16M -XX:MinMetaspaceFreeRatio=50 -XX:MaxMetaspaceFreeRatio=80 -XX:+DisableExplicitGC -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote.host=127.0.0.1 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;A href="https://docs.cloudera.com/cdp-private-cloud-base/7.1.9/kafka-configuring/topics/kafka-config-rolling-restart-client-conf.html" target="_blank" rel="noopener"&gt;https://docs.cloudera.com/cdp-private-cloud-base/7.1.9/kafka-configuring/topics/kafka-config-rolling-restart-client-conf.html&lt;/A&gt;&lt;BR /&gt;Since we are on a non-SSL cluster, below was the configuration tried while following the second link for testing:&lt;BR /&gt;&lt;EM&gt;bootstrap.servers=&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token punctuation"&gt;&amp;lt;&lt;/SPAN&gt;broker-1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:6667,&lt;/SPAN&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token punctuation"&gt;&amp;lt;&lt;/SPAN&gt;broker-2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:6667,&lt;/SPAN&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token punctuation"&gt;&amp;lt;&lt;/SPAN&gt;broker-3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:6667,&lt;/SPAN&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token punctuation"&gt;&amp;lt;&lt;/SPAN&gt;broker-4&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;:6667 security.protocol=SASL_PLAINTEXT ssl.client.auth=none sasl.mechanism=GSSAPI sasl.kerberos.service.name=kafka sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab="/var/run/cloudera-scm-agent/process/18315-kafka-KAFKA_BROKER-kafka_broker_rolling_restart_pre_check/kafka.keytab" principal="&lt;/SPAN&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="token punctuation"&gt;&amp;lt;&lt;/SPAN&gt;KAFKA&lt;/SPAN&gt; &lt;SPAN class="token attr-name"&gt;Principal&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;";&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;Keytab location is hard coded just for 1 broker for testing and ensured that the keytab file exists at the location. We tried rolling restarting this broker, however, it failed.&lt;BR /&gt;Without the above JMX configuration in&amp;nbsp;&lt;STRONG&gt;Advanced configuration snippet,&amp;nbsp;&lt;/STRONG&gt;rolling restart just works fine.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Unsure on what exactly have been configured incorrectly or what is missed. Request to please share your thoughts / recommendations / suggestions on the same.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;snm1523&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2026 06:21:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Configure-JMX-Exporter-java-agent-for-Kafka-CDP-Private-Base/m-p/401119#M251075</guid>
      <dc:creator>snm1523</dc:creator>
      <dc:date>2026-04-21T06:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Configure JMX Exporter (java agent) for Kafka - CDP Private Base 7.1.9</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Configure-JMX-Exporter-java-agent-for-Kafka-CDP-Private-Base/m-p/401400#M251136</link>
      <description>&lt;P&gt;For the benefit of anyone if looking for a solution to this. We need to add the -javaagent parameter in "&lt;SPAN&gt;Additional Broker Java Options" configuration property instead of what mentioned in in the post.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 09:48:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Configure-JMX-Exporter-java-agent-for-Kafka-CDP-Private-Base/m-p/401400#M251136</guid>
      <dc:creator>snm1523</dc:creator>
      <dc:date>2025-02-03T09:48:44Z</dc:date>
    </item>
  </channel>
</rss>

