JMX metrics missing from Lenses UI


Question 

I set up JMX but cannot see any metrics in Lenses.

Answer 

Setting up remote JMX access can be tricky. As such the first step when troubleshooting is to verify that JMX on the Kafka Brokers or Kafka Connect is set up correctly and accessible via Lenses.

To do that, you need to connect to the server, docker container, or kubernetes pod that runs Lenses and use a command line application such as jmxterm to verify the JMX setup. Once you have a terminal on the Lenses server, follow the steps below.

# Download jmxterm
$ wget https://github.com/jiaqi/jmxterm/releases/download/v1.0.2/jmxterm-1.0.2-uber.jar

# Connect to a JMX host and launch an interactive jmx console
$ java -jar jmxterm-1.0.2-uber.jar --url <host:port>

# List available beans
$> beans

If the command beans returned a list of JMX beans, then your JMX setup is healthy and the problem lies in Lenses’ configuration. Check our documentation to learn how to set up Lenses.

If you did not see any JMX beans listed then your JMX setup isn’t correct. There are two possible scenarios:

  1. JMX is enabled correctly on your applications but a firewall restricts access to the JMX port. Ask your operations or platform team for help.
  2. JMX is not enabled, or JMX is restricted to only allow connections from localhost or to a specific address. Check how to enable JMX on Apache Kafka or contact your operations or platform team.

Lenses also supports other type of metrics, such as Jolokia agent and MSK Open Monitoring. In these cases using curl from a terminal on the Lenses server may help you determine if you have access to the remote metrics.

# Verify Jolokia metrics
$ curl -k -X POST "https://user:pass@server:port/jolokia/read/kafka.server:type=app-info,id=*"

# Verify Open Metrics
$ curl "https://servers:port/metrics
--
Last modified: September 26, 2024