JMX (Java Management Extensions) is ideal for monitoring applications built using Java. With Dynatrace, you can monitor any metric in your JVM that is exposed via an MBean.
Create a JMX extension
- Sign in to Dynatrace and go to Settings > Monitoring > Monitored technologies and click Add new technology monitoring. Of the four available options, one is Monitor Java or WebSphere based technologies. Click Add JMX/PMI extension.
- Click Use JMX/PMI extensions editor.
- Type the extension name. You can only use letters
A-Z, a-z, numbers
- Add the metrics source.
- Select one of the available technologies.
- Based on your selection, the editor will suggest the Java process as a source for your metrics. This narrows the list of available MBeans or PMI modules you will use in the next step. The technology behind the process determines whether you'll browse JMX MBeans or PMI modules. Click Add metrics source to use a suggested source. Click to select a different process. When selecting it, you can narrow the list of available processes by choosing a particular host or Management Zone.
Selecting the process, host, or Management Zone doesn't limit the extension monitoring scope. JMX/PMI extensions monitor all Java processes accessible to OneAgent. The metric defined for the same MBean and attribute will be also available in other Java processes across your application, which can quickly exhaust your custom metric limit.
You can also select individual hosts on which to run your new JMX extension, instead of running it globally across your whole environment.
- Immediately after you add your JMX extension, go to Settings> Monitored technologies > Custom extensions tab and disable it globally.
- Navigate to individual host pages, open the host settings, find your JMX extension and enable it.
When the metrics list is downloaded, click the Add metric button to start creating your extension.
Select the domain.
Select key properties
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 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.
The attributes available in the list are only the numeric ones. To see other attributes, for example attributes of the
Stringtype, select Include non-numeric attributes. Note that selected attributes must be parsable to double, or boolean type. Otherwise, Dynatrace OneAgent will not collect any data from such a metric.
You can define a custom display name for the metric.
Select the metric unit.
Select the aggregation method if you're pulling an attribute from a number of matching Mbeans.
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 extension
Creating the PMI extension is very similar to the JMX extension. PMI Module translates to JMX Mbean and statistics to attributes. All other settings behave accordingly.
Saving the extension
After you add the metric, you can still edit or delete its definition. You must click the Save button to register the extension and start collecting data from all Java processes that contain defined MBeans. After you save the extension, you cannot edit or delete the metrics, as this way we're able to 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 extension is already deployed.
Customizing your extension
The Dynatrace JMX extensions are highly customizable beyond the capabilities of the editor. You can download your extension and edit its JSON file that describes your JMX metrics and how you want to display them. For reference and examples, see Customizing JMX Plugins.
You need to create a JSON file that describes your JMX metrics and how you want to display them. For reference and examples, see Customizing JMX Plugins.
Upload a JMX extension
- To add a JMX extension to Dynatrace, go to Settings > Monitored technologies > Custom extensions and click Upload extension.
- Select the
plugin.jsonfile of your JMX extension.
Once successfully uploaded, your extension is listed on the Custom extensions page. You don't need to restart your JVM to enable JMX extensions or make changes effective.
Note: If in the future you make changes to your extension, remember to upload the updated
plugin.jsonfile to Dynatrace.
Viewing JMX metrics in Dynatrace
JMX metrics are available for all Java-based processes monitored by OneAgent.
Once your extension is uploaded, Dynatrace automatically begins querying the defined metrics for all Java processes. To find the metrics, go to a relevant process page and click Further details.
For example, for a extension named
HornetQ, go to the process you selected when creating the extension, click Further details and then select the HornetQ tab named automatically after the extension name. You'll find all the defined metrics there.
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.