Skip to main content

Java Management Extensions (JMX) - OpenTelemetry Collector

Thumbnail icon

Java Management Extensions (JMX) is a standard component of the Java Platform. JMX gives developers a standard and simple way to manage resources, including services, devices, and applications. JMX is dynamic, so you can manage and monitor resources as soon as they are created, implemented, or installed.

The Sumo Logic app for JMX allows you to analyze and gain insights about Java applications. The dashboards provide a quick glance at various deployment metrics like memory, GC performance, and thread behavior, so you can troubleshoot unexpected behavior in your Java environment and the applications running in it.

Metrics types​

The Sumo Logic app for JMX collects metrics from Java applications via the JMX Receiver for OpenTelemetry.

The following types of metrics are collected from JMX:

  • Garbage Collection
  • Memory
  • Memory Pool
  • Threads
  • ClassLoader

For more information on different metrics collected, refer to the JMX receiver docs.

Sample queries​

sumo.datasource=jmx metric=jvm.memory.heap.used

Fields creation in Sumo Logic for JMX​

  • sumo.datasource. Has fixed value of jmx.
  • jmx.endpoint. The endpoint in the form of localhost:port used by JMX Metric Gatherer.

Prerequisites​

The JMX Receiver uses the OpenTelemetry JMX Metric Gatherer. For more details, see their docs.

  • Download the jar from releases and place it in /opt/ or in C:\ProgramData. Remember the path of the jar, which you'll use to configure the JMX app.
  • Make sure the see the opentelemetry-java-contrib-jmx-metrics version is supported in the OpenTelemetry version you are using by going through the releases section and searching for jmxreceiver in that page. You can also check supported jars code.
  • JMX Metric Gatherer metric extension supports Java 8+, though SASL is only supported where com.sun.security.sasl.Provider is available.
  • Configure your java application to enable JMX. In most cases, you'll need to set below system variables in your applications's startup script.
    -Dcom.sun.management.jmxremote.port=11099
    -Dcom.sun.management.jmxremote.authenticate=false
  • If you want to set up authentication, set the below system variables:
    -Dcom.sun.management.jmxremote.authenticate=true
    -Dcom.sun.management.jmxremote.password.file=<application conf directory>/jmx.password
    -Dcom.sun.management.jmxremote.access.file=<application conf directory>/jmx.access
info

Below are docs for popular Java applications:

Collection configuration and app installation​

As part of data collection setup and app installation, you can select the App from App Catalog and click on Install App. Follow the steps below.

Step 1: Set up OpenTelemetry Collector​

note

If you want to use an existing OpenTelemetry Collector, you can skip this step by selecting the Use an existing Collector option.

To create a new Collector:

  1. Select the Add a new Collector option.
  2. Select the platform where you want to install the Sumo Logic OpenTelemetry Collector.

This will generate a command that you can execute in the machine environment you need to monitor. Once executed, it will install the Sumo Logic OpenTelemetry Collector.

Collector

Step 2: Configure integration​

In this step, we'll configure the yaml required for JMX Collection.

Below is the input required:

  • JMX Endpoint. Enter the value in host:port form which will be used to construct the Service URL, the Metric Gatherer's JMX client should use.
  • JMX Gatherer file path. Enter the path to the OpenTelemetry JMX Metric Gatherer file configured in the prerequisites section.
  • Enable password authentication. Toggle this if you are using password based jmx authentication.
  • Username. Username for JMX authentication, if applicable.
  • Password. Password for JMX authentication, if applicable.

Click on the Download YAML File button to get the yaml file.

YAML

Step 3: Send logs and metrics to Sumo​

Once you have downloaded the YAML file as described in the previous step, follow the below steps based on your platform.

  1. Copy the yaml to the/etc/otelcol-sumo/conf.d/ folder for the Java application which needs to be monitored.
  2. Restart the collector using:
sudo systemctl restart otelcol-sumo

After successfully executing the above command, Sumo Logic will start receiving data from your host machine.

Click Next. This will install the app (dashboards and monitors) to your Sumo Logic Org.

Dashboard panels will start to fill automatically. It's important to note that each panel fills with data matching the time range query and received since the panel was created. Results won't immediately be available, but within 20 minutes, you'll see full graphs and maps.

note

If you have multiple Java processes running on the same host, then you need to select Add another Host option under More Actions when installing an app to generate a new YAML configuration file for each of the Java process.

Add Another Host

Viewing JMX Dashboards​

Filter with template variables

Template variables provide dynamic dashboards that can rescope data on the fly. As you apply variables to troubleshoot through your dashboard, you view dynamic changes to the data for a quicker resolution to the root cause. You can use template variables to drill down and examine the data on a granular level. For more information, see Filter with template variables.

Overview​

The JMX - Overview dashboard provides a quick summary of Heap Memory, Memory Pool and Garbage Collection time by different java processes.

Use this dashboard to:

  • Identify the java processes using maximum heap memory and memory pool.
  • Monitor the Percentage Heap Usage and Percentage Memory Pool Usage to avoid OOM errors.
  • Compare the Heap Memory, Memory Pool and Garbage Collection time with last week's trends.
Overview

Memory​

The JMX - Memory dashboard shows the percentage of the heap and non-heap memory used, physical and swap memory usage of your java virtual machine.

Use this dashboard to:

  • Gain insights into Heap and Non-Heap memory usage.
  • Identify the Max Heap and Initial Heap size configured for your application to set the appropriate memory switches.
Memory

Garbage Collector​

The JMX - Garbage Collector dashboard shows key Garbage Collector statistics like the duration of the last GC run, objects collected, threads used, and memory cleared in the last GC run of your java virtual machine.

Use this dashboard to:

  • Understand the garbage collection time. If the time keeps on increasing, you may have more CPU usage.
  • Understand the number of objects collected across memory pools and its impact on the Heap memory.
Garbage Collector

Class Loading and Threads​

The JMX - Class Loading and Threads dashboard shows key information about the number and type of threads deadlocked, peak, and GC threads of your java virtual machine running on the deployment.

Use this dashboard to:

  • Identify abnormal spikes in Threads and Loaded Classes.
Class Loading and Threads

Memory Pool​

The JMX - Memory Pool dashboard provides key information about the memory pool usage, peak usage, collection usage, garbage collection across various memory pools of your Java virtual machine.

Use this dashboard to:

  • Gain insights into memory usage across different memory pools.
  • Gain insights into garbage collection impact on different memory pools.
Memory Pool
Status
Legal
Privacy Statement
Terms of Use

Copyright © 2024 by Sumo Logic, Inc.