springspring-bootjmxjconsolespring-jmx

Access specific JMX metric information on JConsole for a Spring Boot Application


I have a Spring Boot application packaged as a WAR and deployed on a Tomcat 9 server.

It's been configured to expose the following metrics through JMX:

spring.jmx.default-domain: my-app
management.endpoints.jmx.exposure.include: health,info,metrics

I can connect to Tomcat through JConsole and see the my-app MBean that offers those 3 endpoints:

enter image description here

Selecting Metrics -> Operations - listNames I can get the whole list of metrics exposed, invoking the listNames method:

enter image description here

Now I would like to see a specific metric (e.g. jvm.memory.used), going to metrics -> Operations -> metrics:

enter image description here

However the metric(requiredMetricName, tag) method is disabled.

How can I get the value of a specific metric from the mbean in JConsole?


Solution

  • The reason it's disabled is because JConsole won't allow input of parameters of complex types. See https://stackoverflow.com/a/12025340/62667

    But if you use an alternative JMX interface (e.g. add Hawtio to your application) then you could use that to invoke the operations.enter image description here