2

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?

codependent
  • 23,193
  • 31
  • 166
  • 308
  • I guess you are aware that `Spring Boot Actuator` (/actuator/metrics/jvm.memory.used) can give you what you need and the above is for a specific use case that needs JConsole. – jumping_monkey Dec 13 '22 at 08:12

1 Answers1

1

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

GaZ
  • 2,346
  • 23
  • 46