Unlocking Performance Insights: Connecting JConsole to WSO2 MI Docker Container with Ease

Isuru Liyanage
CodeBlog
Published in
2 min readDec 5, 2023

In this blog post, I will guide you through the process of configuring JConsole to connect to a WSO2 MI instance running within a Docker container.

To begin, we’ll initiate the creation of our WSO2 MI Docker image. Our approach involves pulling the latest Docker image from the designated tag docker.wso2.com/wso2mi:4.1.0.0. It’s important to note that a subscription is required to access and pull this specific image. This task will be accomplished using a Dockerfile to streamline the process.

FROM docker.wso2.com/wso2mi:4.1.0.0

Next, we must activate JMX in our MI server. This involves incorporating the following parameters into the micro-integrator.sh file. To obtain the micro-integrator.sh file, you can download the MI pack from the official WSO2 MI website and secure a copy of the file to the directory where your Dockerfile is located. Once obtained, open the file and append the specified parameters.

I will be configuring the JMX remote port to operate on 9999 without any authentication.

    -Dcom.sun.management.jmxremote.port=9999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \

Following the file modifications, it’s essential to include it in our Docker image. To achieve this, you can add the following line to your Dockerfile:

COPY micro-integrator.sh /home/wso2carbon/wso2mi-4.1.0/bin

Now my dockerfile will look like the below

FROM docker.wso2.com/wso2mi:4.1.0.0
COPY micro-integrator.sh /home/wso2carbon/wso2mi-4.1.0/bin

To construct the Docker image, execute the following command in the directory where you’ve crafted the Dockerfile:

docker build .

Once you’ve successfully created the Docker image, launch it using the following command, where the -p flag denotes port forwarding:

docker run -p 8290:8290 -p 9999:9999 8031b100b4dd97ed1ddf369a2e35ed207a9c8a7c4a26aa95583d09879b07d9f9

In case a Docker image tag was not assigned during the build, you’ll need to utilize the Docker image ID when running the Docker image.

Now, let’s initiate JConsole by navigating to the [JDK_HOME]/bin directory. This action will prompt the following window:

Next, click on the “Remote Process”. Provide the hostname and JMX port as follows, then click the “Connect” button:

localhost:9999

You will now be presented with the following window, showcasing a comprehensive array of monitoring statistics for your analysis.

This guide should prove invaluable for your day-to-day monitoring of WSO2 MI.

Happy monitoring!!!!!!

--

--