How do I monitor JMX metrics in my Java applications?

JMX technology (Java Management Extensions) is ideal for monitoring applications built using Java technology. With Dynatrace JMX monitoring plugins, you can monitor any metric in your JVM that is exposed via an MBean.

Create a JMX plugin

You need to create a JSON file that describes your JMX metrics and how you want to display them. For complete instructions and examples, visit the Dynatrace GitHub page.

Upload a JMX plugin

  1. To add a JMX plugin to Dynatrace, go to Settings > Monitored technologies > Custom plugins and click Upload plugin.
  2. Select the plugin.json file of your JMX plugin.
    Once successfully uploaded, your plugin is listed on the Custom plugins page. You don’t need to restart your JVM to enable JMX plugins or make changes effective.
    Note: If in the future you make changes to your plugin, remember to upload the updated plugin.json file to Dynatrace.

Viewing JMX metrics in Dynatrace

Once your plugin is uploaded, Dynatrace automatically begins querying the defined metrics for all Java processes. These metrics are displayed on each relevant process page. If you’ve defined key metrics, you’ll see those metrics included in the infographic. If you defined key charts you’ll see the charts displayed in an aggregate form beneath the infographic (see the HornetQ example below).

Click the Further details tab to see all defined metrics. As described on the Dynatrace GitHub page, Dynatrace allows you to select any MBean’s key property as a dimension. The queue name property was selected for the example below. This way you can select a metric like the queue depth and get it listed for each queue instead of simply getting an aggregate value.

Not seeing a certain metric?
JMX monitoring is highly dynamic. If a particular metric doesn’t exist in your JVM, it’s not an error—the metric simply isn’t available.