The JmxCollector collects performance data via JMX. Attributes are extracted from the available MBeans.
Class Name |
|
Package |
core |
Supported on Minion |
|
Use these parameters in the collectd-configuration.xml file.
Parameter | Description | Required | Default value |
---|---|---|---|
|
The name of the JMX Collection to use. |
required |
(none) |
|
Whether collected performance data should be tested against thresholds |
optional |
|
|
Number of retries |
optional |
|
|
Name of the path in which the metrics should be stored |
optional |
Value of the port, or 'jsr160' if no port is set. |
|
The password strategy to use.
Supported values are: |
optional |
|
|
The connection url, e.g., |
optional |
(none) |
|
The username if authentication is required. |
optional |
(none) |
|
The password if authentication is required. |
optional |
(none) |
|
Deprecated. JMX port. |
optional |
|
|
Deprecated. Protocol used in the |
optional |
|
|
Deprecated. Path used in |
optional |
|
|
Deprecated. RMI port. |
optional |
|
|
Deprecated. Use an alternative |
optional |
|
Note
|
The deprecated parameters port , protocol , urlPath , rmiServerPort and remoteJMX should be replaced with the url parameter.
If url is not defined the collector falls back to legacy mode and the deprecated parameters are used instead to build the connection url.
|
Note
|
If a service requires different configuration, an entry in ${OPENNMS_HOME}/etc/jmx-config.xml can overwrite it.
|
Note
|
Understanding resource types helps when editing collector-specific configuration files. |
Define JMX Collections in etc/jmx-datacollection-config.xml
and etc/jmx-datacollection-config.d/
.
This snippet provides a collection definition named opennms-poller
:
<jmx-collection name="opennms-poller">
<rrd step="300">
<rra>RRA:AVERAGE:0.5:1:2016</rra>
<rra>RRA:AVERAGE:0.5:12:1488</rra>
<rra>RRA:AVERAGE:0.5:288:366</rra>
<rra>RRA:MAX:0.5:288:366</rra>
<rra>RRA:MIN:0.5:288:366</rra>
</rrd>
<mbeans>
<mbean name="OpenNMS Pollerd" objectname="OpenNMS:Name=Pollerd">
<attrib name="NumPolls" alias="ONMSPollCount" type="counter"/>
</mbean>
</mbeans>
</jmx-collection>
Once added to etc/jmx-datacollection-config.xml
you can test it using the collect
command available in the Karaf Shell:
opennms:collect org.opennms.netmgt.collectd.Jsr160Collector 127.0.0.1 collection=opennms-poller port=18980
To support wildcard (*) in objectname, JMX collector supports generic resource types. JMX configuration requires two changes for this to work:
-
Create a custom resource type in
etc/resource-types.d/
. For example, there is already a definition injmx-resource.xml
that defines a custom resource for Kafka lag
<resource-types>
<resourceType name="kafkaLag" label="Kafka Lag"
resourceLabel="${index}">
<persistenceSelectorStrategy class="org.opennms.netmgt.collection.support.PersistAllSelectorStrategy"/>
<storageStrategy class="org.opennms.netmgt.dao.support.SiblingColumnStorageStrategy">
<parameter key="sibling-column-name" value="name" />
</storageStrategy>
</resourceType>
</resource-types>
-
Match the resourceType name as
resource-type
in MBean definition:
<mbean name="org.opennms.core.ipc.sink.kafka.heartbeat" resource-type="kafkaLag" objectname="org.opennms.core.ipc.sink.kafka:name=OpenNMS.Sink.*.Lag">
<attrib name="Value" alias="Lag" type="gauge"/>
</mbean>
JMX objectname is the full name of MBean in form of ( domain:key=value, key=value, ..)
.
Wildcard (*)
can exist anywhere in the objectname.
Depending on wildcard definition, use SiblingColumnStorageStrategy
to extract resource label.
If wildcard exists in the value (usual case), use corresponding key
as the sibling-column-name
parameter. For example:
org.apache.activemq:BrokerName=*,Type=Queue,Destination=com.mycompany.myqueue
Here BrokerName
can be defined as parameter for SiblingColumnStorageStrategy
<parameter key="sibling-column-name" value="BrokerName" />
The extracted BrokerNames from the wildcard will be the resource folders in the form of nodeId/resourceTypeName/{resource-label}
Wildcard may exist in domain as well. For example: org.apache.*:BrokerName=trap, Type=Queue
.
Then domain
can be defined as the sibling-column-name
parameter.
<parameter key="sibling-column-name" value="domain" />
To use the objectname
itself as a resource label, use IndexStorageStrategy
as storageStrategy in resource-type
definition.
Some Java applications provide their own JMX implementation and require certain libraries to be present on the classpath, e.g., the Java application server Wildfly. To successfully collect data, you may need to do the following:
-
Place the jmx client lib to the ${OPENNMS_HOME}/lib folder (e.g., jboss-cli-client.jar)
-
Configure the collection accordingly (see above)
-
Configure the JMX-Collector in collectd-configuration.xml (see below)
<service name="JMX-WILDFLY" interval="300000" user-defined="false" status="on">
<parameter key="url" value="service:jmx:http-remoting-jmx://$\{ipaddr}:9990"/>
<parameter key="retry" value="2"/>
<parameter key="timeout" value="3000"/>
<parameter key="factory" value="PASSWORD-CLEAR"/>
<parameter key="username" value="admin"/>
<parameter key="password" value="admin"/>
<parameter key="rrd-base-name" value="java"/>
<parameter key="collection" value="jsr160"/>
<parameter key="thresholding-enabled" value="true"/>
<parameter key="ds-name" value="jmx-wildfly"/>
<parameter key="friendly-name" value="jmx-wildfly"/>
</service>
<collector service="JMX-WILDFLY" class-name="org.opennms.netmgt.collectd.Jsr160Collector"/>