JMX Active Discovery
JMX Active Discovery can discover:
- All instances of a specified MBean object
- Instances based on attributes of a fully specified MBean
JMX Active Discovery can also discover multiple Java instances on a device listening on multiple ports, and then discover all the objects on each port, creating an array of objects.
Device properties jmx.user and jmx.pass are used for authentication information.
The parameters for JMX Discovery are:
- JMX Path: The location of the MBean or MBean attribute. The path is specified by listing the JMX Domain and the object name.
- Service URL (optional): The URL of the JMX server. If nothing is provided for this field, then a single port is assumed to be declared on the device-level via the custom property "jmx.port", and this field defaults to "service:jmx:rmi:///jndi/rmi://##HOSTNAME##:##jmx.port##/jmxrmi". The ##PORT## token can be declared in the Service URL field to iterate through a list of ports from the "Ports" field to discover multiple JMX objects/JVM instances.
- Ports: A comma separated list of ports to monitor for JMX objects. Typically this field is set to ##jmx.ports## to allow the property to be used to provide the list of ports. The property can be set per device group or per device.
For example, the configuration in the image below would list all the threadpools on a Tomcat server:
If the attribute specified in the JMX Path parameter is:
- a primitive type (such an integer or string), then JMX Active Discovery returns the value of the attribute as the alias and value of instance;
- an array, then Active Discovery returns the array index of each element as the alias and values of the reported instances;
- a map, then Active Discovery returns the set of keys as the alias and values of the reported instances.
Where a list of ports (or a token such as jmx.ports that is replaced with a list of ports) is given in the Portsfield, ##WILDVALUE## is substituted 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. For example, 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 the ##WILDVALUE2## if using port discovery also.
e.g. If you were discovering path="Catalina:type=Manager,host=localhost,path=*"
and the returned results were:
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:
For examples of JMX Active Discovery in action, see the datasources JVM Memory Pools- or Tomcat Sessions-.