Jolokia setup on metricbeat

Hi All,

I've been following the steps to setup the jolokia module within metricbeat and I must be doing something wrong so I need some help. I'm attempting to monitor the JMX and collect data out of mbeans for the Java processes on my server.

Do i need a separate jolokia agent running on the server to do this? or can enabling the module and giving the machine:port be enough to collect the data?

So the module is enabled:

$ ls -al modules.d/ | grep jolok
-rw-r----- 1 lc33574 users  210 Jan 26 18:12 jolokia.yml

I borrowed the configuration from Here

This is the configuration I'm using:

metricbeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false

metricbeat.modules:
- module: system
  metricsets:
    - cpu
    - filesystem
    - memory
    - network
    - process
  enabled: true
  period: 10s
  processes: ['.*']
  cpu_ticks: false

- module: jolokia
  metricsets: ["jmx"]
  enabled: true
  period: 10s
  namespace: "jolokia_metrics"
  hosts: ["localhost:27110"]
  jmx.mappings:
    - mbean: 'java.lang:type=Runtime'
      attributes:
        - attr: Uptime
          field: uptime
    - mbean: 'java.lang:type=GarbageCollector,name=ConcurrentMarkSweep'
      attributes:
        - attr: CollectionTime
          field: gc.cms_collection_time
        - attr: CollectionCount
          field: gc.cms_collection_count

processors:
- add_cloud_metadata:

output.elasticsearch:
  hosts: ["https://servername:9200"]
  username: "elastic"
  password: "1234"
  ssl.certificate_authorities: ["/path/to/ca.crt"]

setup.kibana:
  host: "kibana:5601"
  username: "elastic"
  password: "1234"

When i attempt to start metricbeat I get this:

$ ./metricbeat -e -c metricbeat.yml
2018/06/26 15:08:28.516519 beat.go:436: INFO Home path: [/home/lc33574/metricbeat-6.1.3-linux-x86_64] Config path: [/home/lc33574/metricbeat-6.1.3-linux-x86_64] Data path: [/home/lc33574/metricbeat-6.1.3-linux-x86_64/data] Logs path: [/home/lc33574/metricbeat-6.1.3-linux-x86_64/logs]
2018/06/26 15:08:28.516560 metrics.go:23: INFO Metrics logging every 30s
2018/06/26 15:08:28.516602 beat.go:443: INFO Beat UUID: bd386ed9-bba9-4fab-80f2-5b97ba2a75b0
2018/06/26 15:08:28.516615 beat.go:203: INFO Setup Beat: metricbeat; Version: 6.1.3
2018/06/26 15:08:31.516838 add_cloud_metadata.go:297: INFO add_cloud_metadata: hosting provider type not detected.
2018/06/26 15:08:31.517428 client.go:123: INFO Elasticsearch url: https://servername:9200
2018/06/26 15:08:31.517697 module.go:76: INFO Beat name: servername1
2018/06/26 15:08:31.517985 cfgwarn.go:18: WARN DEPRECATED: cpu_ticks is deprecated. Add 'ticks' to the cpu.metrics list. Will be removed in version: 6.1
2018/06/26 15:08:31.518103 cfgwarn.go:18: WARN DEPRECATED: cpu_ticks is deprecated. Use process.include_cpu_ticks instead Will be removed in version: 6.1
2018/06/26 15:08:31.518414 cfgwarn.go:11: WARN BETA: The jolokia jmx metricset is beta
2018/06/26 15:08:31.518596 beat.go:276: INFO metricbeat start running.
2018/06/26 15:08:31.519481 cfgwarn.go:11: WARN BETA: The jolokia jmx metricset is beta
2018/06/26 15:08:31.519706 metrics.go:51: INFO Total non-zero values:  beat.info.uptime.ms=3014 beat.memstats.gc_next=4194304 beat.memstats.memory_alloc=2806744 beat.memstats.memory_total=4348896 libbeat.config.module.running=0 libbeat.output.type=elasticsearch libbeat.pipeline.clients=2 libbeat.pipeline.events.active=0
2018/06/26 15:08:31.519730 metrics.go:52: INFO Uptime: 3.014844423s
2018/06/26 15:08:31.519736 beat.go:284: INFO metricbeat stopped.
2018/06/26 15:08:31.519749 beat.go:635: CRIT Exiting: 1 error: 1 error: missing required field accessing '0.jmx.mappings' (source:'/home/lc33574/metricbeat-6.1.3-linux-x86_64/modules.d/jolokia.yml')
Exiting: 1 error: 1 error: missing required field accessing '0.jmx.mappings' (source:'/home/lc33574/metricbeat-6.1.3-linux-x86_64/modules.d/jolokia.yml')

If i disable the module it runs with no issues.

Can someone point me in the right direction please?

Thanks - Dennis

Did you take a look at Monitoring Java applications with Metricbeat and Jolokia | Elastic Blog, we just published that yesterday.

From the post you have to deploy Jolokia in the same JVM or as a proxy mode.

To deploy Jolokia as a WAR, the agent has to be installed in the Java EE server. For example, in Tomcat this is done by copying the WAR file to its webapps directory. For each application, it is recommended to check their documentation for the best way to run Java agents. It is also recommended to look at Jolokia documentation to see what agents are available and what their options are. For cases where it is not possible to deploy Jolokia in the same JVM, Jolokia also has a proxy mode that can be used to query JMX from another JVM.

Thanks @pierhugues. I'm not able to do this so but thanks for confirming.

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