# Capturing all JMX attributes for an object (wildcard support in attribute)?

**URL:** <https://discuss.elastic.co/t/capturing-all-jmx-attributes-for-an-object-wildcard-support-in-attribute/288610>\
**Category:** APM\
**Tags:** java\
**Created:** [November 8, 2021, 9:49am UTC](https://discuss.elastic.co/t/capturing-all-jmx-attributes-for-an-object-wildcard-support-in-attribute/288610 "2021-11-08T09:49:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthias\_W](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthias_w/32/96451_2.png) [@Matthias\_W](https://discuss.elastic.co/u/Matthias_W)\
**Post date:** [November 8, 2021, 9:49am UTC](https://discuss.elastic.co/t/capturing-all-jmx-attributes-for-an-object-wildcard-support-in-attribute/288610/1 "2021-11-08T09:49:28Z")

</div>

I am trying to use the Elastic APM Java agent to capture JMX metrics for a JBoss application server.

If I set the `capture_jmx_metrics` property to  
`object_name[jboss.as:subsystem=datasources,xa-data-source=myDb, statistics=pool] attribute[ActiveCount]`  
I receive metrics with `jvm.jmx.ActiveCount` in Kibana:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/8/88a4dfebd65be6d100cfbf879f7e80e1472318a0.png).

However, now I would like to collect **all** (30+) attributes of this object.

The [documentation](https://www.elastic.co/guide/en/apm/agent/java/current/config-jmx.html) states:

> The name of the JMX attribute. The JMX value has to be either a `Number` or a composite where the composite items are numbers. This element can be defined multiple times. An attribute can contain optional properties. The syntax for that is the same as for [`ObjectName`](https://docs.oracle.com/javase/7/docs/api/javax/management/ObjectName.html).  
> [...]  
> **The [JMX object name pattern](https://docs.oracle.com/javase/7/docs/api/javax/management/ObjectName.html) supports wildcards**.

When I change my property to include a wildcard for the attribute, however, I don't see any metrics:  
`object_name[jboss.as:subsystem=datasources,xa-data-source=myDb, statistics=pool] attribute[*]`

Which makes me wondering whether wildcards are actually supported or not. Maybe I just misunderstood the documentation?

Thanks!

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [November 9, 2021, 8:26am UTC](https://discuss.elastic.co/t/capturing-all-jmx-attributes-for-an-object-wildcard-support-in-attribute/288610/2 "2021-11-09T08:26:37Z")

</div>

Yes,

> The syntax for that is the same as for [`ObjectName`](https://docs.oracle.com/javase/7/docs/api/javax/management/ObjectName.html)

is misleading...  
It means that you can use `:` and `=` similar to the ObjectName syntax, but you cannot use `*` for the attribute name (which would be the matching object name domain).

You will have to add all attributes that you are interested at in the configuration (the syntax supports multiple attribute entries).

---

<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:** [November 30, 2021, 4:26am UTC](https://discuss.elastic.co/t/capturing-all-jmx-attributes-for-an-object-wildcard-support-in-attribute/288610/3 "2021-11-30T04:26:44Z")

</div>

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