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 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?