# Java agent and jmx metrics

**URL:** <https://discuss.elastic.co/t/java-agent-and-jmx-metrics/285652>\
**Category:** APM\
**Tags:** java\
**Created:** [October 1, 2021, 6:54am UTC](https://discuss.elastic.co/t/java-agent-and-jmx-metrics/285652 "2021-10-01T06:54:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johanostberg](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@johanostberg](https://discuss.elastic.co/u/johanostberg)\
**Post date:** [October 1, 2021, 6:54am UTC](https://discuss.elastic.co/t/java-agent-and-jmx-metrics/285652/1 "2021-10-01T06:54:49Z")

</div>

Hi im struggling with metrics from jmx and jboss eap.

i would like to get the same metrics as we get from Prometheus:

- "jboss.as:deployment=_,subsystem=ejb3,_"
- "jboss.as:deployment=\*,subsystem=undertow"
- "jboss.as:deployment=_,subsystem=undertow,servlet=_"
- "jboss.as:deployment=_,subdeployment=_,subsystem=ejb3,\*"
- "jboss.as:deployment=_,subdeployment=_,subsystem=undertow"
- "jboss.as:deployment=_,subdeployment=_,subsystem=undertow,servlet=\*"
- "jboss.as:subsystem=datasources,data-source=\*,statistics=jdbc"
- "jboss.as:subsystem=datasources,data-source=\*,statistics=pool"
- "jboss.as:subsystem=datasources,xa-data-source=\*,statistics=jdbc"
- "jboss.as:subsystem=datasources,xa-data-source=\*,statistics=pool"
- "jboss.as:subsystem=messaging-activemq,server=_,jms-queue=_"
- "jboss.as:subsystem=messaging-activemq,server=_,jms-topic=_"
- "jboss.as:subsystem=transactions"
- "jboss.as:subsystem=undertow,server=_,http-listener=_"

i got datasources working but nothing else:  
object\_name[jboss.as:subsystem=datasources,data-source=\*,statistics=pool] attribute[AvailableCount] attribute[ActiveCount] attribute[InUseCount] attribute[TimedOut] attribute[WaitCount]

Do you have any examples for getting info about jms queue/topics and sessions???

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [October 1, 2021, 12:19pm UTC](https://discuss.elastic.co/t/java-agent-and-jmx-metrics/285652/2 "2021-10-01T12:19:02Z")

</div>

Hi @johanostberg,

Are those all the JMX object names that you want to monitor (and that you might already capture through Prometheus) ?

From what I understand in your case

- all of the datasources (starting with `jboss.as:subsystem=datasources`) are properly captured as expected.
- all objects starting with the following prefixes are not captured
  - `jboss.as:subsystem=messaging`
  - `jboss.as:subsystem=transactions`
  - `jboss.as:subsystem=undertow`

We had a few issues with JBoss and JMX metrics in the past where JMX notifications are not consistent:

- For all of those attributes, can you tell us if are you able to read them using `jconsole` or `visualvm` tools from the JMX tree ?
- does the issue also happens when [using the runtime attach](https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-cli.html), thus without the `-javaagent` option and after JBoss server startup ?

---

<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:** [October 22, 2021, 8:19am UTC](https://discuss.elastic.co/t/java-agent-and-jmx-metrics/285652/3 "2021-10-22T08:19:30Z")

</div>

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