# JMX error fetching data

**URL:** <https://discuss.elastic.co/t/jmx-error-fetching-data/197486>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [August 30, 2019, 9:37am UTC](https://discuss.elastic.co/t/jmx-error-fetching-data/197486 "2019-08-30T09:37:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rokcarl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rokcarl/32/53239_2.png) [@rokcarl](https://discuss.elastic.co/u/rokcarl)\
**Post date:** [August 30, 2019, 9:37am UTC](https://discuss.elastic.co/t/jmx-error-fetching-data/197486/1 "2019-08-30T09:37:19Z")

</div>

I'm trying to send JMX data using a Dockerized Metricbeat to the cloud, but I get the following error:

```
2019-08-30T09:30:45.033Z	INFO	module/wrapper.go:247	Error fetching data for metricset jolokia.jmx: error making http request: Post http://localhost:9998/jolokia: EOF

```

Here's some of my config:

```
- module: jolokia
  metricsets: ["jmx"]
  period: 1s
  hosts: ["localhost:9998"]
  namespace: "metrics"
  jmx.mappings:
    - mbean: 'java.lang:type=Runtime'
      attributes:
        - attr: Uptime
          field: uptime
          event: 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

```

I'm running my Java application with the following options:

```
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.rmi.port=9998 -Dcom.sun.management.jmxremote.port=9998

```

I hope the above satisfies the requirement from the [Elastic JMX docs](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-metricset-jolokia-jmx.html) for the JMX agent through JVM.

I've verified that I can connect and see metrics by running the jmxterm tool:

```
java -jar jmxterm-1.0.1-uber.jar -l localhost:9998
Welcome to JMX terminal. Type "help" for available commands.
$>beans
#domain = JMImplementation:
JMImplementation:type=MBeanServerDelegate
#domain = com.sun.management:
com.sun.management:type=DiagnosticCommand
com.sun.management:type=HotSpotDiagnostic
#domain = io.dropwizard:
io.dropwizard:type=Logging
#domain = java.lang:
java.lang:name=CodeCacheManager,type=MemoryManager
java.lang:name=CodeHeap 'non-nmethods',type=MemoryPool
java.lang:name=CodeHeap 'non-profiled nmethods',type=MemoryPool
...

```

Any ideas why this is happening?

---

<div class="post-metadata">

**Author:** ![rokcarl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rokcarl/32/53239_2.png) [@rokcarl](https://discuss.elastic.co/u/rokcarl)\
**Post date:** [September 17, 2019, 5:32am UTC](https://discuss.elastic.co/t/jmx-error-fetching-data/197486/2 "2019-09-17T05:32:15Z")

</div>

I was using the JVM flags, but apparently that's not a Jolokia agent.  
Installing that as a separate JAR file fixed things.

---

<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 15, 2019, 5:32am UTC](https://discuss.elastic.co/t/jmx-error-fetching-data/197486/3 "2019-10-15T05:32:21Z")

</div>

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