Skip to content

Instantly share code, notes, and snippets.

@kofemann
Last active June 20, 2019 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kofemann/e5fde5b1b505b3882ca02b4d879bfdff to your computer and use it in GitHub Desktop.
Save kofemann/e5fde5b1b505b3882ca02b4d879bfdff to your computer and use it in GitHub Desktop.
Reporting dCache java process CPU and Memory usage with beats

Reporting dCache CPU & Memory usage with metricbeats

Pre-requisites

  • Download and install Metricbeat. Use metricbeat-oss package, if you don't have xpack
  • Download Jolokia's JVM agent

Enable Jolokia JVM agent

The Jolokia JVM agent should be enabled for each dCahce java process that should be monitored:

dcache.java.options.extra=-javaagent:/etc/dcache/jolokia-jvm-agent.jar=port=7771,host=localhost

NOTE, if you run multiple dCache domains on the same host, the each process must have it's own unique port number.

For all possible configuration options of Jolokia JVM agent check the official documentation

Configure Metricbeat to collect desired information

Enable jolokia module for metricbeat:

$ metricbeat modules enable jolokia

Update /etc/metricbeat/modules.d/jolokia.yml file add add all agents ports:

- module: jolokia
  metricsets: ["jmx"]
  period: 10s
  hosts: ["localhost:7771"]
  http_method: 'GET'
  namespace: "metrics"
  jmx.mappings:
    - mbean: 'java.lang:type=Runtime'
      attributes:
        - attr: Uptime
          field: uptime
    - mbean: 'java.lang:type=Memory'
      attributes:
        - attr: HeapMemoryUsage
          field: memory.heap_usage
        - attr: NonHeapMemoryUsage
          field: memory.non_heap_usage
    - mbean: java.lang:type=Threading
      attributes:
        - attr: ThreadCount
          field: threads.live
        - attr: DaemonThreadCount
          field: threads.daemon
    - mbean: java.lang:type=OperatingSystem
      attributes:
        - attr: ProcessCpuLoad
          field: cpu.process_load
        - attr: SystemCpuLoad
          field: cpu.system_load

Start All

  • start dCache $ dcache start
  • start/enable metricbeat service $ systemctl start metricbeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment