Metricbeat 5.4.0 Jolokia module

I'm trying to use the Jolokia module. When I try to start metricbeats it gives me an error "missing required field accessing 'metricbeat.modules.1.jmx.mappings'" when I try to start metricbeats.

This is my config for the module

  hosts: ["localhost:8474"]
  namespace: "metrics"
  path: "/jolokia/?ignoreErrors=true&canonicalNaming=false"

    - mbean: 'java.lang:type=Runtime'
        - attr: Uptime
          field: uptime
          field_type: integer

    - mbean: 'java.lang:type=GarbageCollector,name=PS MarkSweep'
        - attr: CollectionTime
          field: gc.cms_collection_time
        - attr: CollectionCount
          field: gc.cms_collection_count
          field_type: integer

    - mbean: 'java.lang:type=Memory'
        - attr: HeapMemoryUsagePercent
          field: memory.heap_usage_pct
          field_type: integer
        - attr: NonHeapMemoryUsage
          field: memory.non_heap_usage
          field_type: integer

    - mbean: 'java.lang:type=OperatingSystem'
        - attr: ProcessCpuLoad
          field: cpu.processload.pct
          field_type: integer

    - mbean: 'java.lang:type=ClassLoading'
        - attr: LoadedClassCount
          field: classloaded.classcount
          field_type: integer
        - attr: TotalLoadedClassCCount
          field: classloading.totalclasscount
          field_type: integer

    - mbean: 'java.lang:type=Threading'
        - attr: DaemonThreadCount
          field: threadcount.daemon
          field_type: integer
        - attr: DeadlockedThreadCount
          field: threadcount.deadlocked
          field_type: integer
        - attr: PeakThreadCount
          field: threadcount.peak
          field_type: integer
        - attr: ThreadCount
          field: threadcount.threadcount
          field_type: integer
  jmx.application: application1

  jmx.instance: instance1

Can you please tell me what might be wrong?
Thank you for your time.

You use jmx.mapping bug it reuquires jmx.mappings (see s at the end)

1 Like

Thanks. That worked. But now I get this error
"error": "Cannot unmarshal json response: invalid character '\x00' looking for beginning of value",
"jolokia": {
"jmx": {}
"metricset": {
"host": "localhost:8474",
"module": "jolokia",
"name": "jmx",
"rtt": 1109
"type": "metricsets"

Interesting. Any chance you could fetch the output manually and potentially paste it here on in a gist. Would be nice to do some testing on it and see if we have an unexpected output here.

Do we need to have Jolokia agent/client installed on the server? We have the JEE Agent (WAR) installed on the server which is described on here There's no errors in the logs but none of the fields are coming through to the index pattern even after refreshing the field list. I was wondering if you have any suggestions?

Based on the jolokia docs I would assume your setup should be fine. Can you manually access the endpoint?

Using the jmx4perl we get the following ;
Name: Apache Tomcat
Vendor: Apache
Version: 7.0.78

Heap-Memory used : 86 MB
Heap-Memory alloc : 631 MB
Heap-Memory max : 1751 MB
NonHeap-Memory max : 130 MB
Classes loaded : 2868
Classes total : 2869
Threads current : 31
Threads peak : 32
CPU Arch : amd64
CPU OS : Linux 2.6.32-431.el6.x86_64
Memory total : 1775 MB
Memory free : 1775 MB
Swap total : 2047 MB
Swap free : 2027 MB
FileDesc Open : 53
FileDesc Max : 4096
Name : 13789@server
JVM : 24.79-b02 Java HotSpot(TM) 64-Bit Server VM Oracle Corporation
Uptime : 31 m, 46 s
Starttime : Wed May 24 10:25:41 2017

but metricbeat is giving us;
May 24th 2017, 10:35:44.702 metricset.module:jolokia @timestamp:May 24th 2017, 10:35:44.702 beat.hostname:servername beat.version:5.4.0 error:Cannot unmarshal json response: invalid character '\x00' looking for beginning of value metricset.rtt:995 type:metricsets _id:AVw7GXtjZtE6CXXOqSF2 _type:metricsets _index:metricbeat-2017.05.24 _score: -

Could you try it with only 1 Mbean, for example the Runtime one and see if that works?
You defined the path which is identical to the default path. Should not have any affect, but perhaps leave it out?

Could you check what you get if you fetch the following url in your browser or over curl: http://localhost:8778/jolokia/?ignoreErrors=true&canonicalNaming=false Can you paste the output here?

Please change the port to 8474 as you seem to have a different port.

I apologize for my late reply. I figured out where the issue was. We needed to use the JVM Agent listed under 3.4. JVM Agent on this tutorial for Jolokia . Then set what port we wanted to use to get the metrics with Metricbeat. Thank you for your help with this.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.