How to get JVM Memory used with metricbeat jolokia module

I'm trying to use Jolokia + metricbeat to gather Info about the JVM Memory.

I did everything like described in the docs but it won't work. Jolokia jmx metricset | Metricbeat Reference [7.11] | Elastic

- mbean: 'java.lang:type=Memory'
   - attr: HeapMemoryUsage
     field: memory.heap_usage
   - attr: NonHeapMemoryUsage
     field: memory.non_heap_usage

I can collect other JMX metrics thou. Does anybody know how to solve this issue? I'm using latest jolokia with latest elastic stack

I already tried downgrading Jolokia to 1.5


If you curl to the jolokia endpoint will you see this metric? You need to verify that your jolokia agent provides it and with what labels.

Also please check if Metricbeat reports any errors.

Calling that endpoint with curl yields the expected result and metricbeat does not report any errors

Did you run Metribeat in debug mode? (./metricbeat -e -d "*") please only add the specific mbean in the config so as to have less noise and check if logs can give us anything useful.

With your advice we could trace the problem further. Apart from deactivating the unrelevant mbeans, we also deactivated other modules like 'system'. After that we could clearly see that the data is sent without an issue.

Checking the Logs of Logstash we figured that it was not able to ingest the data due to an error in an elasticsearch pipeline.

I wrote this pipeline a while ago to extract useful information from the mbean field. Sadly this field did not exist in the jmx metrics JVM memory. I changed the pipeline to ignore the absence of the field mbean and it started working for a while.

I found another issue but did not analyze it further. We are only interested in the attribute HeapMemoryUsage. Configuring it properly did not yield any data. It only starts working after configuring the attribute NonHeapMemoryUsage additionally.