# MetricBeat to capture all available Mbeans from Jolokia

**URL:** <https://discuss.elastic.co/t/metricbeat-to-capture-all-available-mbeans-from-jolokia/146273>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [August 28, 2018, 6:47am UTC](https://discuss.elastic.co/t/metricbeat-to-capture-all-available-mbeans-from-jolokia/146273 "2018-08-28T06:47:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kathir\_J](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@Kathir\_J](https://discuss.elastic.co/u/Kathir_J)\
**Post date:** [August 28, 2018, 6:47am UTC](https://discuss.elastic.co/t/metricbeat-to-capture-all-available-mbeans-from-jolokia/146273/1 "2018-08-28T06:47:03Z")

</div>

Hello Team,

I really enjoyed working with Metricbeat and jolokia together to get my application Mbeans.  
Below is my module configuration from metricbeat.yml

In this I have one static Mbean name which will never get changes but I have a dynamic Mbean : 'com.app:name=JobDetailedDiagnostics- **APT/KMN/FACILITY**' which gets changed everytime I restart my server.

## Below are my questions:

1. I understand Jolokia exposes dynamically created Mbeans but from metricbeat side, how do i configure dynamically created Mbeans?

2. I have around 100+ Mbeans. I want to push all the Mbean information. So is there any way like jmx.mappings: all so that it would fetch all the available Mbeans?  
(In this case I dont need to worry about Dynamically created Mbeans too as everything will be pushed regardless of dynamic or static)

- module: jolokia  
metricsets: ["jmx"]  
period: 10s  
hosts: ["[http://localhost:8280/jolokia-war-1.6.0/](http://localhost:8280/jolokia-war-1.6.0/)"]  
namespace: "n4metrics"  
username: "tomcat"  
password: "\*\*\*\*\*\*"  
jmx.mappings:
  - mbean: 'com.app:name=SystemHealthDiagnostics'  
attributes:
    - attr: ActiveSessions  
field: ActiveSessions
    - attr: NumberOfSlowQueries  
field: NumberOfSlowQueries
    - attr: ActiveDatabaseConnections  
field: ActiveDatabaseConnections
    - attr: SlowQueriesTimeFrameInMillis  
field: SlowQueriesTimeFrameInMillis
    - attr: SystemActive  
field: SystemActive
    - attr: Description  
field: Description

  - mbean: 'com.app:name=JobDetailedDiagnostics- **APT/KMN/FACILITY**'  
attributes:
    - attr: LocallyScheduledJobs  
field: LocallyScheduledJobs
    - attr: LocallyExecutingJobs  
field: LocallyExecutingJobs
    - attr: AllDiagnostics  
field: AllDiagnostics
    - attr: LocallyScheduledJobCount  
field: LocallyScheduledJobCount
    - attr: LocalExecutingJobCount  
field: LocalExecutingJobCount
    - attr: MaxThreadPoolCount  
field: MaxThreadPoolCount
    - attr: Description  
field: Description  
..........  
..........  
..........

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [August 28, 2018, 9:35pm UTC](https://discuss.elastic.co/t/metricbeat-to-capture-all-available-mbeans-from-jolokia/146273/2 "2018-08-28T21:35:50Z")

</div>

Hi @Kathir_J,

Before proceeding further I want to clarify some terminology first.

> [@Kathir\_J](#):
>
> In this I have one static Mbean name which will never get changes but I have a dynamic Mbean : 'com.app:name=JobDetailedDiagnostics- **APT/KMN/FACILITY**' which gets changed everytime I restart my server.

When you say "dynamic Mbean" are you referring to the dynamic naming of the class, i.e. `JobDetailedDiagnostics-*`. Or are you referring to the concept of classes implementing the `DynamicMBean` interface, as shown here: [https://docs.oracle.com/cd/E19206-01/816-4178/6madjde4l/index.html](https://docs.oracle.com/cd/E19206-01/816-4178/6madjde4l/index.html)?

---

<div class="post-metadata">

**Author:** ![Kathir\_J](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@Kathir\_J](https://discuss.elastic.co/u/Kathir_J)\
**Post date:** [August 30, 2018, 1:53pm UTC](https://discuss.elastic.co/t/metricbeat-to-capture-all-available-mbeans-from-jolokia/146273/3 "2018-08-30T13:53:38Z")

</div>

Yep.. I meant dynamic naming of the class. Anyways I found out that with \* search, able to retrieve the dynamically created Mbean attributes.  
Thanks anyways.  
My 2nd question was to include all Mbeans without mentioning Mbean names under jmx mappings?

something like,

module: jolokia  
metricsets: ["jmx"]  
period: 10s  
hosts: ["[http://localhost:8280/jolokia-war-1.6.0/](http://localhost:8280/jolokia-war-1.6.0/)"]  
namespace: "n4metrics"  
username: "tomcat"  
password: "\*\*\*\*\*\*"  
jmx mappings: \*

Is there a way?

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [August 30, 2018, 3:35pm UTC](https://discuss.elastic.co/t/metricbeat-to-capture-all-available-mbeans-from-jolokia/146273/4 "2018-08-30T15:35:43Z")

</div>

We don't support something like `jmx.mappings: *` because it could lead to a potential explosion of fields in Elasticsearch, depending on the number of MBeans and the number of attributes in each.

It's something we could consider, though. If you are on GitHub, please file an issue for this request here: [https://github.com/elastic/beats/issues/new](https://github.com/elastic/beats/issues/new). That way you'll be notified of any discussions and progress. If you aren't on GitHub, let me know and I'll file the issue for you.

---

<div class="post-metadata">

**Author:** ![Kathir\_J](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@Kathir\_J](https://discuss.elastic.co/u/Kathir_J)\
**Post date:** [August 30, 2018, 4:30pm UTC](https://discuss.elastic.co/t/metricbeat-to-capture-all-available-mbeans-from-jolokia/146273/5 "2018-08-30T16:30:16Z")

</div>

Have raised an issue in Github.

[https://github.com/elastic/beats/issues/8168](https://github.com/elastic/beats/issues/8168)

---

<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:** [September 27, 2018, 4:30pm UTC](https://discuss.elastic.co/t/metricbeat-to-capture-all-available-mbeans-from-jolokia/146273/6 "2018-09-27T16:30:18Z")

</div>

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