Using custom JMX and PMI measures in charts

What are JMX and PMI measures?

Use the Java Management Extension (JMX) to manage and monitor Java-based applications. The JMX interface invokes methods on MBeans to retrieve Performance Monitoring Infrastructure (PMI) data. AppMon supports JMX and provides an interface for third-party applications integration.

Goal of this tutorial

To explain how to do the following:

  • Browse the MBeans and PMI groups on an application server.
  • Add these attributes as measures.
  • Add these measures to charts.

Scenario

Use the easyTravel demo application for this demonstration. Add a custom JMX measure and chart it.

Step-by-step creation of PMI measures is not covered here, as it works exactly the same way.

Detailed steps

1. Create a measure

  1. Open the System Profile Preferences > Measure dialog box.
  2. Click Create Measure. The Measure configuration dialog box appears.
  3. Find and select the Custom JMX Measure metric from the Server Side Performance > Agent based Measures > Cutom JMX group. You can hit Ctrl+F and type in JMX to find it easily.
    Selected Metric
  4. In the Custom JMX Measure Specific Attributes section, click Browse Metrics. A warning message may appear, simply close it. The Metric browser dialog box appears.
  5. In the Agent group field, click Pick Agent. The Agent Browser dialog box appears. Agent Browser
  6. Select the BusinessBackend_easyTravel Agent, and click OK. The list of all MBeans for that Agent appears in the Metric browser dialog box.
    Avalable MBeans
  7. Select the required attribute. In this tutorial it's Active in tomcat.jdbc > ConnectionPool > <dataSourceName>. This tells you how many active connections data source has at any given time. You can hit Ctrl+F and type in active to find it easily. Selected metric
  8. Give a meaningful name to your new measure. If needed, configure aggregation. If you want to use the new measure to define incidents, you need to configure thresholds as well. However, we're not doing it in this tutorial.
    Note that the fields of Custom JMX Measure Specific Attributes section are populated with the selected data. Measure finalization
  9. Click Add to create a new measure, and then close the Measure configuration dialog box.
  10. Save the changes to the System Profile, and close the System Profile Preferences dialog box.

PMI

To create a PMI custom measure, select Custom PMI measure metric from Server Side Performance > Agent based Measures > WebSphere at the step 3.

JMX attribute note

If the JMX attribute type is a bean that provides getter methods to access measurement values, use the path expression to specify how to access the measurement values. If the bean provides the method getValue(), which returns the desired measurement, access this value with a JMX subscription and set the path expression to getValue().

The following table provides values, path expressions and explanations for attribute types:

Attribute Type Desired Value Path Expression Explanation
getter Return value getValue() Calls method getValue() on the JMX attribute.
nested getter Return value of nested getter. getValue().getNestedValue() Calls method getValue() on the JMX attribute.

Calls method getNestedValue on the object returned by getValue().
getter with parameter Return value for specific parameter. getValue(param) Calls method getValue() with one string parameter, with parameter value param.
getter returning collection or array. Aggregate of values in collection or array. getValue().size() Iterates over elements of collection or array. For a map, it iterates over the values of the map.

Calls method size() on each element and calculates an aggregate value. For example, the sum average according to the aggregation configuration of the JMX subscription.
getter returning collection or array. Value of a specific element of the collection or array getValue()[key].size() Fetches the element identified by ?key from the collection or array.

Calls method size() on this element.

2. Chart the measure

To chart the new measure:

  1. Create a new dashboard, and add a Chart dashlet to it.
  2. Click Add Series.
  3. Select the measure you've just created and click Add. You can hit Ctrl+F and type in JMX to find it easily. Selected measure
  4. You have to wait, while AppMon gathers data with the new measure. Refresh the dashlet after some time, by hitting Ctrl+F5. Charted measure