# Metricbeat 5.4.0 Jolokia module

**URL:** <https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [May 18, 2017, 6:34pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319 "2017-05-18T18:34:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [May 18, 2017, 6:34pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/1 "2017-05-18T18:34:21Z")

</div>

Hi,  
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

```auto
  hosts: ["localhost:8474"]
  namespace: "metrics"
  path: "/jolokia/?ignoreErrors=true&canonicalNaming=false"
  jmx.mapping:

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

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

    - mbean: 'java.lang:type=Memory'
      attributes:
        - 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'
      attributes:
        - attr: ProcessCpuLoad
          field: cpu.processload.pct
          field_type: integer

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

    - mbean: 'java.lang:type=Threading'
      attributes:
        - 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.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [May 19, 2017, 2:36pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/2 "2017-05-19T14:36:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [May 19, 2017, 7:46pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/3 "2017-05-19T19:46:29Z")

</div>

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"  
}

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [May 22, 2017, 11:35am UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/4 "2017-05-22T11:35:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [May 22, 2017, 5:18pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/5 "2017-05-22T17:18:21Z")

</div>

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 [https://jolokia.org/reference/html/agents.html](https://jolokia.org/reference/html/agents.html). 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?

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [May 23, 2017, 1:08pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/6 "2017-05-23T13:08:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [May 23, 2017, 2:36pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/7 "2017-05-23T14:36:18Z")

</div>

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

Memory:  
Heap-Memory used : 86 MB  
Heap-Memory alloc : 631 MB  
Heap-Memory max : 1751 MB  
NonHeap-Memory max : 130 MB  
Classes:  
Classes loaded : 2868  
Classes total : 2869  
Threads:  
Threads current : 31  
Threads peak : 32  
OS:  
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  
Runtime:  
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.name](http://beat.name):servername beat.version:5.4.0 error:Cannot unmarshal json response: invalid character '\x00' looking for beginning of value metricset.host:ip: [8474metricset.name](http://8474metricset.name):jmx metricset.rtt:995 type:metricsets \_id:AVw7GXtjZtE6CXXOqSF2 \_type:metricsets \_index:metricbeat-2017.05.24 \_score: -

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [May 26, 2017, 6:12am UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/8 "2017-05-26T06:12:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [May 31, 2017, 5:45pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/9 "2017-05-31T17:45:32Z")

</div>

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 [https://jolokia.org/reference/html/agents.html#agents-jvm](https://jolokia.org/reference/html/agents.html#agents-jvm) . Then set what port we wanted to use to get the metrics with Metricbeat. Thank you for your help with this.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 28, 2017, 5:45pm UTC](https://discuss.elastic.co/t/metricbeat-5-4-0-jolokia-module/86319/10 "2017-06-28T17:45:40Z")

</div>

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