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 JMX monitoring plugins, you can monitor any metric in your JVM that is exposed via an MBean. No coding required. Use our JMX/PMI plugin editor to integrate JMX and PMI metrics with Dynatrace in matter of minutes.

Creating the JMX plugin

  1. Sign in to Dynatrace and go to Settings > Monitoring > Monitored technology and click Add new technology monitoring button. Out of the four available options, one is Monitor Java or WebSphere based technologies. Click Add JMX/PMI plugin.
  2. Select the Java process to narrow the list of available MBeans or PMI modules you will use in next step. The technology behind the process determines whether you'll browse JMX Mbeans or PMI modules. You can also select a particular host to narrow the list of available processes.

Note

Selecting the process and host doesn't limit the plugin monitoring scope. JMX/PMI plugins monitor all Java processes accessible to OneAgent. The metric defined for the same MBean and attribute will be also available in other Java process across your application, which can quickly exhaust your custom metric limit.

  1. Click Get metrics to download JMX Mbeans or PMI Modules from the processes and hosts you selected.

  2. When the download is complete, click Add metric button to start creating your plugin.

    Domain

    Select the domain.

    Select key proporties

    Key properties filter the list of available MBeans. Note that property values can contain wildcards. Select Exact match to filter MBeans list only to the entries matching the exact key property values.

    Select MBean

    Select one MBean from the list or leave All matching MBeans option. If more than one Mbean is matched, this will cause the aggregation of attributes from all matching MBeans into one metric. You will define the aggregation type below.

    Select attribute

    The attributes available in the list are only the numeric ones. To see other attributes, for example attributes of the String type, select Include non-numeric attributes. Note that selected attributes must be parsable to double, or Boolean type. Otherwise, Dynatrace One Agent will not collect any data from such a metric.

    Display name

    You can define a custom display name for the metric.

    Unit

    Select the metric unit.

    Aggregation

    Select the aggregation method if you're pulling an attribute from a number of matching Mbeans.

    Calculation

    Delta calculates the change in values of the given attribute. Rate calculates the rate of changes per seconds. When you select both, you can convert an absolute attribute (eg. Request Count) to a rate (eg. Requests per Second). Value = attribute / query interval.

Creating the PMI plugin

Creating the PMI plugin is very similar to the JMX plugin. PMI Module translates to a JMX Mbean and statistics to attributes. All other settings behave accordingly.

Saving the plugin

After you add the metric, you can still edit or delete its definition. You must click the Save button to register the plugin and start collecting data from all Java processes that contain defined MBeans. After you save the plugin, you cannot edit or delete the metrics, as this way we're able maintain the continuity of your data. You can still add the new metrics. This time however, you won't be able to select the base Java process, because you will use a process where the plugin is already deployed. What you can also do is to download your plugin and edit it manually by applying changes in the Json code.

Viewing JMX metrics in Dynatrace

Note:
JMX metrics are available for all Java-based processes monitored by OneAgent.

Once your plugin is registered, 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. In the example below, the queue name key property was selected as the dimension for the metric, which listed the metric for each queue instead of simply getting an aggregate value.