Site icon Vinsguru

JMX Monitoring using Collectd + InfluxDB + Grafana

We have already seen monitoring CPU / Memory utilization using Collectd (this article). But It does not give all the information to identify the bottleneck of a Performance issue. In this article, we will be using Collectd Java plugin to monitor and manage Java Virtual Machine (JVM) using its JMX technology.

Goal:

To monitor and manage the Java Virtual Machine (JVM) using Java’s JMX technology.

Architecture:

Our high level architecture will be as shown here – We will be monitoring JVM of all our app servers, JMeter-servers and JMeter-master.

JMX (Java Managed Extensions):

JMX was introduced in Java 5.0 release to manage / monitor the resources at run time. Using JMX, We will be able to monitor memory usage, garbage collection, loaded classes, thread count etc over time. This is more useful information in Performance Engineering. More Info is here.

As the above picture shows, using the JMX connector, clients like JConsole/Collectd talks to the MBean server to get the metrics of the application we are interested in.

 

JConsole:

JConsole is a GUI tool to monitor JVM. It comes with Java JDK. Let see how it can help us with monitoring JMeter. [I assume you have JDK installed]

Monitoring Remote Process:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=6969
-Dcom.sun.management.jmxremote.rmi.port=6969
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

-Djava.rmi.server.hostname=${HOST_IP}

export JVM_ARGS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.rmi.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.rmi.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

service:jmx:rmi:///jndi/rmi://hostname:6969/jmxrmi

 

Collectd Java Plugin:

JConsole is a nice tool. But it does not maintain historical data. We already use Collectd to monitor CPU & Memory utilization of our jmeter-servers & app servers. There are Java & JMX plugins for Collectd, which we could use, to collect JMX metrics into InfluxDB.

Please read this article first on collectd usage.

I am going to add below section in the collectd config file.

Restart the collectd service. Wait for few minutes to collect some metrics.

 

Once you have this data, then last step would be create a dashboard in Grafana to create graphs.

 

Summary:

Using Collectd plugins, along with CPU & Memory utilization, we can also collect JMX metrics into InfluxDB. Using Grafana, We can visualize, performance test results (min, max, avg response times, througput etc), JMX metrics (heap memory usages, loaded classes count, thread count, GC) & other metrics like CPU & Memory utilization of all the JMeter servers, App servers.

 

Happy Testing & Subscribe 🙂

 

 

 

Share This:

Exit mobile version