Jolokia jmx metricset

edit

The jmx metricset collects metrics from Jolokia agents.

Features and configuration

edit

Tested with Jolokia 1.5.0.

To collect metrics from a Jolokia instance, define a mapping section that specifies an MBean ObjectName followed by an array of attributes to fetch. For each attribute in the array, specify the Elastic field name where the returned value will be saved.

For example, to get the Uptime attribute from the java.lang:type=Runtime MBean and map it to an event field called jolokia.testnamespace.uptime, configure the following mapping:

- module: jolokia
  metricsets: ["jmx"]
  hosts: ["localhost:8778"]
  namespace: "testnamespace" 
  jmx.mappings:
    - mbean: 'java.lang:type=Runtime'
      attributes:
        - attr: Uptime
          field: uptime 
          event: uptime 
      target:
          url: "service:jmx:rmi:///jndi/rmi://targethost:9999/jmxrmi"
          user: "jolokia"
          password: "s!cr!t"

The namespace setting is required. This setting is used along with the module name to qualify field names in the output event.

The field where the returned value will be saved. This field will be called jolokia.testnamespace.uptime in the output event.

The event setting is optional. Use this setting to group all attributes with the same event value into the same event when sending data to Elastic.

If the underlying attribute is an object (such as the HeapMemoryUsage attribute in java.lang:type=Memory), its structure will be published to Elastic "as is".

You can configure nested metric aliases by using dots in the mapping name (for example, gc.cms_collection_time). For more examples, see /jolokia/jmx/test/config.yml.

All metrics from a single mapping will be POSTed to the defined host/port and sent to Elastic as a single event. To make it possible to differentiate between metrics from multiple similar applications running on the same host, you should configure multiple modules.

When wildcards are used, an event is sent to Elastic for each matching MBean, and an mbean field is added to the event.

Limitations

edit

All Jolokia requests have canonicalNaming set to false. See the Jolokia Protocol documentation for more detail about this parameter.

Exposed fields, dashboards, indexes, etc.

edit

Because this module is very general and can be tailored for any application that exposes its metrics over Jolokia, it comes with no exposed field descriptions, dashboards, or index patterns.

Fields

edit

For a description of each field in the metricset, see the exported fields section.

Here is an example document generated by this metricset:

{
    "@timestamp": "2017-10-12T08:05:34.853Z",
    "beat": {
        "hostname": "host.example.com",
        "name": "host.example.com"
    },
    "jolokia": {
        "testnamespace": {
            "memory": {
                "heap_usage": {
                    "committed": 112721920,
                    "init": 64673792,
                    "max": 921174016,
                    "used": 81023984
                },
                "non_heap_usage": {
                    "committed": 24576000,
                    "init": 24576000,
                    "max": 224395264,
                    "used": 17684240
                }
            },
            "uptime": 580487
        }
    },
    "metricset": {
        "host": "jolokia:8778",
        "module": "jolokia",
        "name": "jmx",
        "namespace": "testnamespace",
        "rtt": 115
    }
}