LogicMonitor uses the JMX collection method to collect performance and configuration data from Java applications using exposed MBeans (Managed Beans). These MBeans represent manageable resources in the Java Virtual Machine (JVM), including memory, thread pools, and application-specific metrics.

To collect data using the JMX collection method, configure a datapoint that references a specific MBean and one of its attributes. Specify the following:

  • MBean ObjectName— A domain and one or more key–value properties.
    For example, domain=java.lang, properties type=Memory.
  • Attribute— The attribute to collect from the MBean.

Each MBean exposes one or more attributes that can be queried by name. These attributes return one of the following:

  • A primitive Java data type (for example, int, long, double, or string)
  • An array of data (for example, an array of primitives or nested objects)
  • A hash of data (for example, key–value pairs, including nested structures or attribute sets)

LogicMonitor supports data collection for all JMX attribute types.

Note:
LogicMonitor does not support JMX queries that include dots (periods) unless they are used to navigate nested structures.For example:

  • rep.Container is invalid if it is a flat attribute name.
  • MemoryUsage.used is valid if MemoryUsage is a composite object and used in a field inside it.

When configuring the JMX datapoint, LogicMonitor uses this information to identify and retrieve the correct value during each collection cycle.

For more technical details on MBeans and the JMX architecture, see Oracle’s JMX documentation.

Simple Attribute Example

If the attribute is a top-level primitive:

  • MBean ObjectNamejava.lang:type=Threading
  • MBean AttributeThreadCount

LogicMonitor collects the total number of threads in the JVM.

Nested Attribute Example

If the attribute is part of a composite or nested object, use the dot/period separator as follows:

  • MBean ObjectNamejava.lang:type=Memory
  • MBean AttributeHeapMemoryUsage.used

LogicMonitor collects the amount of heap memory used.

Multi Level Selector Example

To collect data from a map or nested structure with indexed values:

  • MBean ObjectNameLogicMonitor:type=rrdfs
  • MBean AttributeQueueMetrics.move.key1

LogicMonitor retrieves the value associated with the key key1 from the map identified by index move under the QueueMetrics attribute of the MBean.

CompositeData and Map Support

Some JMX MBean attributes return structured data such as:

  • CompositeData: A group of named values, like a mini object or dictionary.
  • Map: A collection of key-value pairs.

LogicMonitor supports collecting values from both.

Accessing CompositeData Example

A CompositeData attribute is like a box of related values, where each value has a name (field). To collect a specific field from the structure, use a dot (.) separator.

MBeanjava.lang:type=GarbageCollector,name=Copy

AttributeLastGcInfo

Value TypeCompositeData

To access the specific value for the number of GC threads use: LastGcInfo.GcThreadCount

Note: Maps in JMX behave similarly to CompositeData, but instead of fixed fields, values are retrieved using a key.

TabularData Support

Some MBean attributes return data in the form of TabularData, a structure similar to a table, with rows and columns. LogicMonitor can extract specific values from these tables.

A TabularData object typically consists of:

  • Index columns: Used to uniquely identify each row (like primary keys in a database)
  • Value columns: Contain the actual data you want to collect

You can access a value by specifying:

  • The row index (based on key columns)
  • The column name for the value you want

Single Index TabluarData Example

The MBean java.lang:type=GarbageCollector,name=Copy has an attribute LastGcInfo. One of its child values, memoryUsageAfterGc, is a TabularData.
Single Index TabluarData Example

The table has 2 columns – key and value. The column key is used to index the table so you can uniquely locate a row by specifying an index value.

For example, key=”Code Cache” returns the 1st row.

To retrieve the value from the value column of the row indexed by the key "Eden Space", use the expression: LastGcInfo.memoryUsageAfterGc.Eden Space.value
In this expression, "Eden Space" is the key used to identify the specific row, and value is the column from which the data will be collected.

Multi-Index TabularData Example

Some tables use multiple index columns to identify rows.
Multi-Index TabularData Example

This TabularData structure has four columns, with process and heap serving as index columns. A unique row is identified by the combination of these index values.
To retrieve the value from the committed column in the row where process=Tomcat and heap=Perm Gen, use the expression: LastGcInfo.memoryUsageAfterGc.Tomcat,Perm Gen.committed
Here, Tomcat,Perm Gen specifies the row, and committed is the column containing the desired value.

Array or List Support

Some MBean attributes return arrays or lists of values. LogicMonitor supports collecting data from these array or list values using index-based access.

For example, the MBean: java.lang:type=GarbageCollector,name=Copy has an Attribute: MemoryPoolNames with Type: String[]
Array or List Support

To access/collect the first element of this array, the expression “MemoryPoolNames.0“ can be used, where “0” is the index to the array (0-based).

You can access the array elements by changing the index as follows:

  • MemoryPoolNames.0 = "Eden Space"
  • MemoryPoolNames.1  =  "Survivor Space"

The same rule applies if the attribute is a Java List. Use the same dot and index notation.

To enable JMX collection for array or list attributes:

  1. Make sure your Java application exposes JMX metrics.
  2. Confirm that the username and password for JMX access are correctly set as device properties:
    • jmx.user
    • jmx.pass

These credentials allow the Collector to connect to the JMX endpoint and retrieve the attribute data, including elements in arrays or lists.

Configuring a Datapoint using the JMX Collection Method

  1. In LogicMonitor, navigate to Modules. Add a new DataSource or open an existing module to add a datapoint for JMX collection.
    For more information, see Custom Module Creation or Modules Management in the product documentation.
  2. In the Collection Method field, select “JMX”.
    Configuring a Datapoint using the JMX Collection Method
  3. Select Add a Normal Datapoint.
  4. In the Name field, enter a name for the datapoint.
  5. In the Description field, enter a description.
  6. In the MBean object field, enter the MBean path, including the domain and properties. 
  7. In the MBean attribute field, enter the specific attribute or nested field to collect.
  8. In the Metric Type field, select the metric type for the response.
  9. Configure any additional settings, if applicable.
    Configuring additional settings for the datapoint
  10. Select save Save.

The datapoint is saved for the module and you can configure additional settings for the module as needed. For more information, see Custom Module Creation or Modules Management.

Troubleshooting JMX Data Collection

Collector does not support the first-level JMX attributes that contain dots(.). By default, the Collector treats dots as path separators to access nested data. If the dot is simply a part of the attribute’s name and not intended to indicate a hierarchy, it can cause:

  • ANullPointerException in the JMX debug window,
  • NaN (Not a Number) values in the Poll Now results, and
  • Failure to collect data correctly

Mitigating JMX Data Collection Issues

To prevent data collection errors with attributes that include dots, do the following:

  1. Identify the attribute name in your MBean that contains dots.
    For example (attribute name): jira-software.max.user.count
  2. Determine whether the dots are part of the attribute name or indicate a nested path.
    • If the dots are part of the attribute name, escape each dot with a backslash (\.).
      For example: jira-software\.max\.user\.count
    • If the dots indicate navigation inside a structure, do not escape them.
  3. Enter the attribute in the LogicModule or JMX Debug window, using the escaped form only when the dots are part of the attribute name.
  4. Verify the data collection using the Poll Now feature or JMX debug window.

Attribute Interpretation Examples

Attribute FormatInterpreted in Collector Code as
jira-software.max.user.countjira-software, max, user, count (incorrect if flat attribute)
jira-software\.max\.user\.countjira-software.max.user.count (correct interpretation)
jira-software\.max.user\.countjira-software.max, user.count
jira-software.max.user\.countjira-software, max, user.count