Pricing Login
Pricing
Support
Demo
Interactive demos

Click through interactive platform demos now.

Live demo, real expert

Schedule a platform demo with a Sumo Logic expert.

Start free trial
Back to blog results

March 2, 2021 By Mike Mackrory

Analyze JMX to better assess the health of your Java applications

Java Management Extensions, or JMX, was first added to J2EE, and it has been part of J2SE since the 5.0 release. The JMX API aims to provide a standard for monitoring and managing Java-enabled applications and services. In this article, we will explain the JMX architecture and show you how to pull the metrics that it generates into your Sumo Logic account in order to gain unique insights and a more thorough understanding of the health of your application and services.

Introduction to JMX

JMX uses a three-level architecture to gather, aggregate, and expose metrics. The three levels are:

  • The Probe Level

  • The Agent Level

  • The Remove Management Level

The Probe Level

The Probe level is responsible for gathering and collecting data. JMX makes use of Managed Beans (or MBeans) to gather statistics from applications or services within the application. Some examples of services that MBeans can instrument include JDBC drivers and transactional monitors.

The MBeans emit notifications that include data values related to performance and resource usage. They can also return configuration information and notify listeners about errors. Specialized MBeans can gather and report on JVM subsystems such as multi-threading, memory usage, and garbage collection.

The Agent Level

The Agent level, also known as the MBeanServer, is responsible for gathering data from each of the MBeans, and it is central to everything JMX does.

The Remote Management Level

The Remote Management level is where consumers can access the data that is generated by JMX. Various connectors and adapters form an API that supports protocols such as IIOP, JMS, and RMI. Adapters can adapt data to make it accessible to SNMP and HTTP sources.

Moving Beyond Instrumentation

JMX is an excellent solution for the instrumentation of your Java applications. By accessing the endpoints exposed by the Remote Management level, you can gain insight into the current state of the JVM and other aspects of your application. In many ways, it’s like the dashboard in your car – your dashboard shows your current speed, RPMs, and the amount of gasoline in your tank, whereas JMX shows CPU metrics, memory allocations, and Garbage Collection statistics.

Observing this data over time can be valuable as well. It’s a bit like when your teenager borrows the car – even though your speedometer currently reads 0mph, you know from the smell of the brakes that it has probably gathered an insightful collection of data related to metrics of speed.

One way to track JMX metrics over time and view them in an easy-to-read and intuitive format is to partner with a provider like Sumo Logic. Sumo Logic helps you set up the necessary infrastructure to capture your JMX data. Once your data flows from your applications and services into your Sumo Logic account, you can view the data in a series of prebuilt dashboards. You also have the option of building custom dashboards to capture and visualize additional data points.

Connecting JMX Data and Sumo Logic

If you don’t already have a Sumo Logic account, you can sign up for a free trial. You can find links to more detailed documentation at the end of this article, but first, we’ll give you a basic overview of how it fits together.

Sumo Logic enables the collection of JMX data from both Kubernetes and non-Kubernetes environments.

In a non-Kubernetes environment, you can create a pipeline that includes:

  • The Jolokia JVM Agent

  • The Telegraf Collector

The Jolokia Agent works directly with the JVM to expose JMX data in JSON format over HTTP. The Telegraf Collector connects the agent and manages the collection of metrics as well as their transmission to your Sumo Logic account. Within Telegraf, you can configure the MBeans’ names to collect data from the target destination. You can also configure the frequency with which Telegraf will transmit the data.

In a Kubernetes environment, you connect to the JVMs with the Telegraf Operator, which is included in the Sumo Logic Kubernetes Collection. You use annotations to configure the MBeans’ names to collect data and define the destination as well as the frequency with which it transmits information.

Once you’ve configured Telegraf to collect your metrics and transmit them to Sumo Logic, you can log into your account to view your data. To do so, navigate to the App Catalog, select the JMX App, and then configure the App Name and the Data Source. You can find detailed instructions in the Sumo Logic Doc Hub.

JMX Dashboards on Sumo Logic

Sumo Logic has several JMX dashboards that provide visibility into various aspects of the JVM. If you have extended JMX to monitor additional aspects of your application, you can create a new dashboard and add customized charts based on queries for the unique data.

There are several JMX Dashboards available, including:

  • JMX - Overview (shows overall JVM health)

  • JMX - Memory (heap, non-heap, physical, and swap memory usage)

  • JMX - CPM (CPU and process usage)

  • JMX - Garbage Collector (GC collection time and heap memory impact)

  • JMX - Thread (peak, daemon, and current thread counts)

  • JMX - Memory Pool (memory pool usage, peak usage, and GC impact)

  • JMX - Class Loading and Compilation (class count and compilation times)

Learning More

The Sumo Logic Doc Hub includes detailed instructions about JMX metric collection, including:

You can access the Sumo Logic Community to ask questions, and for additional assistance, you can find answers to questions that other users have asked. You can also submit a support request if you can’t find a solution to a particular challenge.

Complete visibility for DevSecOps

Reduce downtime and move from reactive to proactive monitoring.

Sumo Logic cloud-native SaaS analytics

Build, run, and secure modern applications and cloud infrastructures.

Start free trial
Mike Mackrory

Mike Mackrory

Mike Mackrory is a Global citizen who has settled down in the Pacific Northwest — for now. By day he works as a Lead Engineer on a DevOps team, and by night, he writes and tinkers with other technology projects. When he's not tapping on the keys, he can be found hiking, fishing and exploring both the urban and rural landscape with his kids. Always happy to help out another developer, he has a definite preference for helping those who bring gifts of gourmet donuts, craft beer and/or single-malt Scotch.

More posts by Mike Mackrory.

People who read this also enjoyed