# MetricBeat Jolokia configuration

**URL:** <https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [March 23, 2018, 5:48am UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305 "2018-03-23T05:48:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishnuduttpv](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vishnuduttpv](https://discuss.elastic.co/u/vishnuduttpv)\
**Post date:** [March 23, 2018, 5:48am UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/1 "2018-03-23T05:48:16Z")

</div>

Hi,  
The following is my conf.  
ElasticSearch - 6.2.2  
Logstash - 6.2.2  
Kibana - 6.2.2  
Metricbeat - 6.2.2

I am trying to pull the JMX data from my clients using the jolokia module in the metricbeat. I had installed the jolokia in my target clients and enabled the jolokia module in the metricbeat. While manually checking through the browser Iam getting the result throgh jolokia as expected. Following is my metricbeat jolokia conf,  
_- module: jolokia_  
\_ metricsets: ["jmx"]\_  
\_ period: 10s\_  
\_ hosts: ["10.10.114.155:8085"]\_  
\_ namespace: "metrics"\_  
\_ path: "/jolokia/read/"\_  
\_ jmx.mapping:\_  
\_ - mbean: 'java.lang:type=Runtime'\_  
\_ attributes:\_  
\_ - attr: Uptime\_  
\_ field: uptime\_

But while restarting the metricbeat I am getting the following error,  
_2018-03-23T11:04:36.866+0530 ERROR instance/beat.go:667 Exiting: 1 error: 1 error: missing required field accessing '0.jmx.mappings' (source:'/etc/metricbeat/modules.d/jolokia.yml')_

Request to advise ! ☹  
Thanks in advance!

Vishnu!

---

<div class="post-metadata">

**Author:** ![agathver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agathver/32/27733_2.png) [@agathver](https://discuss.elastic.co/u/agathver)\
**Post date:** [March 23, 2018, 5:57am UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/2 "2018-03-23T05:57:20Z")

</div>

@vishnuduttpv

You perhaps have a small typo in the config. You need to define `jmx.mappings`, in order to properly unmarshall JSON response from Jolokia.

Here is a config I use:

```auto
- module: jolokia
  metricsets: ["jmx"]
  enabled: true
  period: 10s
  namespace: "jolokia_metrics"
  hosts: ["localhost:8081"]
  jmx.mappings:
    - mbean: 'java.lang:type=Runtime'
      attributes:
        - attr: Uptime
          field: uptime
    - mbean: 'java.lang:type=GarbageCollector,name=ConcurrentMarkSweep'
      attributes:
        - attr: CollectionTime
          field: gc.cms_collection_time
        - attr: CollectionCount
          field: gc.cms_collection_count
    - mbean: 'java.lang:type=Memory'
      attributes:
        - attr: HeapMemoryUsage
          field: memory.heap_usage
        - attr: NonHeapMemoryUsage
          field: memory.non_heap_usage

```

---

<div class="post-metadata">

**Author:** ![vishnuduttpv](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vishnuduttpv](https://discuss.elastic.co/u/vishnuduttpv)\
**Post date:** [March 23, 2018, 6:41am UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/3 "2018-03-23T06:41:57Z")

</div>

@agathver Thanks for the reply with the sample! I tried with the sample. Its working. But in the metric beat logs I am getting the following error that the fields are missing.  
2018-03-23T12:11:18.550+0530 INFO template/load.go:73 Template already exists and will not be overwritten.  
_2018-03-23T12:11:27.564+0530 ERROR schema/schema.go:41 Error on field 'server\_uptime': Missing field: server\_uptime, Error: Key `ServerUptimeSeconds` not found_  
_2018-03-23T12:11:27.564+0530 ERROR schema/schema.go:41 Error on field 'user': Missing field: user, Error: Key `CPUUser` not found_  
_2018-03-23T12:11:27.564+0530 ERROR schema/schema.go:41 Error on field 'system': Missing field: system, Error: Key `CPUSystem` not found_  
_2018-03-23T12:11:27.565+0530 ERROR schema/schema.go:41 Error on field 'children\_user': Missing field: children\_user, Error: Key `CPUChildrenUser` not found_  
_2018-03-23T12:11:27.565+0530 ERROR schema/schema.go:41 Error on field 'children\_system': Missing field: children\_system, Error: Key `CPUChildrenSystem` not found_  
_2018-03-23T12:11:37.565+0530 ERROR schema/schema.go:41 Error on field 'children\_system': Missing field: children\_system, Error: Key `CPUChildrenSystem` not found_  
_2018-03-23T12:11:37.565+0530 ERROR schema/schema.go:41 Error on field 'user': Missing field: user, Error: Key `CPUUser` not found_  
_2018-03-23T12:11:37.565+0530 ERROR schema/schema.go:41 Error on field 'system': Missing field: system, Error: Key `CPUSystem` not found_  
_2018-03-23T12:11:37.565+0530 ERROR schema/schema.go:41 Error on field 'children\_user': Missing field: children\_user, Error: Key `CPUChildrenUser` not found_  
_2018-03-23T12:11:37.565+0530 ERROR schema/schema.go:41 Error on field 'server\_uptime': Missing field: server\_uptime, Error: Key `ServerUptimeSeconds` not found_

Is there any tomcat version dependencies ? I am using apache tomcat 7! and installed the jolokia as a webarchive accessible through [http://x.x.x.x:8085/jolokia](http://x.x.x.x:8085/jolokia)  
Thanks in advance!  
Vishnu

---

<div class="post-metadata">

**Author:** ![agathver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agathver/32/27733_2.png) [@agathver](https://discuss.elastic.co/u/agathver)\
**Post date:** [March 23, 2018, 7:49am UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/4 "2018-03-23T07:49:44Z")

</div>

> [@vishnuduttpv](#):
>
> 2018-03-23T12:11:18.550+0530 INFO template/load.go:73 Template already exists and will not be overwritten.  
> ...  
> 2018-03-23T12:11:37.565+0530 ERROR schema/schema.go:41 Error on field 'server\_uptime': Missing field: server\_uptime, Error: Key ServerUptimeSeconds not found

This is some other error related to the system module in Metricbeats. Check the `modules.d/system.yaml`

> [@vishnuduttpv](#):
>
> Is there any tomcat version dependencies ? I am using apache tomcat 7! and installed the jolokia as a webarchive accessible through [http://x.x.x.x:8085/jolokia](http://x.x.x.x:8085/jolokia)

I don't think so. This does not seem related to the Jolokia module.

---

<div class="post-metadata">

**Author:** ![vishnuduttpv](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vishnuduttpv](https://discuss.elastic.co/u/vishnuduttpv)\
**Post date:** [March 23, 2018, 9:16am UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/5 "2018-03-23T09:16:46Z")

</div>

@agathver Thanks for the reply! But the systems.yml is working fine and its sending the correct metrics too. The jolokia conf is as follows. I added some more detailed metrics in the conf.  
_- module: jolokia_  
\_ metricsets: ["jmx"]\_  
\_ enabled: true\_  
\_ period: 10s\_  
\_ namespace: "jolokia\_metrics"\_  
\_ hosts: ["10.10.114.155:8085"]\_  
\_ path: "/jolokia/?ignoreErrors=true&canonicalNaming=false"\_  
\_ jmx.mappings:\_  
\_ #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\_

But I think its related with the JMX data,because i tried by disabling the jolokia module.  
Really I am stuck! ☹

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![agathver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agathver/32/27733_2.png) [@agathver](https://discuss.elastic.co/u/agathver)\
**Post date:** [March 23, 2018, 3:13pm UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/6 "2018-03-23T15:13:40Z")

</div>

Could you please check the Apache module? On closer inspection, the values seem like those from Apache status page.

Please use three backticks to enclose any code/conf snippets that you post it makes it easier to read , as it invokes syntax highlighting and preserves whitespace. 🙂

Like:

````auto
```yaml
- module: jolokia
  metricsets: ["jmx"]
  enabled: true
  period: 10s
 ...
 ...
 ...

```

````

Which outputs:

```auto
- module: jolokia
  metricsets: ["jmx"]
  enabled: true
  period: 10s

```

---

<div class="post-metadata">

**Author:** ![vishnuduttpv](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vishnuduttpv](https://discuss.elastic.co/u/vishnuduttpv)\
**Post date:** [March 26, 2018, 9:20am UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/7 "2018-03-26T09:20:11Z")

</div>

@agathver Sorry for the misalignment of the codes. Thanks for the reply!  
I tried by disabling the Apache! As suspected it was coming from the apache module itself! But in kibana, I am getting the results from the apache server. And also related with the jolokia, Iam not getting any logs of the jolokia module in kibana!  
Whether there is any default dashboards for the Jolokia Module, in kibana? If yes how to import it in the kibana?  
Thanks in advance!  
Vishnu

---

<div class="post-metadata">

**Author:** ![agathver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agathver/32/27733_2.png) [@agathver](https://discuss.elastic.co/u/agathver)\
**Post date:** [March 27, 2018, 4:26pm UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/8 "2018-03-27T16:26:52Z")

</div>

As of now there are no default dashboards for the Jolokia module.

We are working for some standardization of JMX MBeans by the JVM and other applications like Tomcat.

Hopefully I'll be working on creating dashboards for Jolokia in the coming days.

---

<div class="post-metadata">

**Author:** ![vishnuduttpv](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vishnuduttpv](https://discuss.elastic.co/u/vishnuduttpv)\
**Post date:** [March 28, 2018, 5:39am UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/9 "2018-03-28T05:39:31Z")

</div>

@agathver Thanks for the reply! I was working with the jolokia module for monitoring our test app servers. So its successful with the apache and other modules. Is there any way to create a dashboard manually from my end so that I can forward with the testing for jolokia! Sorry ,as I am newbie to the KIBANA. Request you to advise!  
Thanks in advance  
Vishnu

---

<div class="post-metadata">

**Author:** ![agathver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agathver/32/27733_2.png) [@agathver](https://discuss.elastic.co/u/agathver)\
**Post date:** [March 28, 2018, 4:32pm UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/10 "2018-03-28T16:32:25Z")

</div>

There are some dashboard building instructions here: [https://www.elastic.co/guide/en/kibana/current/dashboard-getting-started.html](https://www.elastic.co/guide/en/kibana/current/dashboard-getting-started.html)

The key is to identify the ES queries you need and representing the result with the appropriate visualization.

---

<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:** [April 25, 2018, 4:33pm UTC](https://discuss.elastic.co/t/metricbeat-jolokia-configuration/125305/11 "2018-04-25T16:33:02Z")

</div>

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