» JMX ActiveDiscovery

JMX ActiveDiscovery can discover:

  • all instances of a specified MBean object
  • instances based on attributes of a fully specified MBean.

JMX ActiveDiscovery can also discover multiple Java instances on a host listening on multiple ports, and then discover all the objects on each port, creating an array of objects.

Host properties jmx.user and jmx.pass are used for authentication information.

The parameters for JMX Discovery are:

  • Service URL: the URL of the JMX server. This parameter is optional - if not provided, it defaults to: service:jmx:rmi:///jndi/rmi://##HOSTNAME##:##jmx.port##/jmxrmi
  • JMX Path: the location of the MBean or MBean attribute. The path is specified by listing the JMX Domain and the object name.
  • Ports: a comma separated list of ports to monitor for JMX objects. Typically this is set to ##jmx.ports## to allow the property to be used to provide the list of ports. The property can be changed per group or per host.

e.g. the above configuration would list all the threadpools on a Tomcat server.

If the attribute specified in the path parameter is:

  • a primitive type (such an integer or string), JMX Active Discovery returns the value of the attribute  as the alias and value of instance;
  • an array, Active Discovery returns the array index of each element as the alias and values of the reported instances;
  • a map, Active Discovery returns the set of keys as the alias and values of the reported instances.

Where jmx.ports are used, the token ##WILDVALUE## is subsituted for the port  at collection time, while ##WILDVALUE2## is substituted for the discovered JMX object (or attribute.)

If an attribute value or values are to be discovered (instead of an MBean object name), the attribute should be separated from the object by a colon.

e.g. to discover an instance with the value of the serverInfo attribute of the Server Mbean in the Catalina domain, specify a JMX Path of "Catalina:type=Server:serverInfo"

This would return an instance with the value of the attribute serverInfo as returned by the Tomcat server, such as "Apache Tomcat/5.5.25". This value could then be used in filtering, if desired.

Filtering in JMX

JMX filtering can be applied to either the port, the discovered MBean paths, or to the discovered attribute values.

If the attribute specified in the filter is  a path, or path component, it will be treated as a string. You can include the variable discovered part of the path by use of the ##WILDVALUE## token (or ##WILDVALUE2## if using port discovery also).

e.g. if you were discovering path="Catalina:type=Manager,host=localhost,path=*"

and the returned results were:

/
/myapp
/example
/myotherapp

You could include only your specific applications by adding a filter:

filter1

An alternative way of filtering is based on attribute values. You could, for example, create a filter that dynamically included all paths that have ever had any valid sessions:

filter2

For examples of JMX Active Discovery in action, see the datasources JMXJavaMemoryPools- or TomcatSessions-.