Monitoring WSO2 ESB using JConsole
- Charitha Kankanamge
- Senior Manager, Support - WSO2
Introduction
Monitoring the status of production systems in real time is a critical feature expected from any enterprise grade server platform. The WSO2 Enterprise Service Bus (ESB) facilitates users monitoring the server locally or remotely using JMX (Java Management eXtensions), with various types of MBeans provided by WSO2 ESB which expose the different statistics, resource monitoring, latency, threading data, etc. You can use any JMX client to view the JMX statistics provided by ESB. While J2SE version 5.0 and above adds core support for the JMX to the Java standard libraries.
In this tutorial, we use JConsole, included in Sun JDK 1.5 or newer versions, to explore the management and monitoring capabilities provided by WSO2 ESB. Also, please note that the location of the file system to which you will extract WSO2 ESB binary distributions will be CARBON_HOME.
Applies To
WSO2 Enterprise Service Bus (ESB) | 3.0.1 or above |
Table of Contents
We will look into the following topics in this tutorial:
1. Enabling Remote JMX Monitoring in WSO2 ESB
2. Connecting to ESB using JConsole
1. Enabling Remote JMX Monitoring in WSO2 ESB
There are two different ways of monitoring a java application:
- Local monitoring
- Remote monitoring
If you want to monitor a locally running ESB instance, you can simply find out the process ID of the server instance and use JConsole to connect to the particular process. However, if the server is running remotely, then you need to enable remote JMX monitoring in WSO2 ESB. In order to enable JMX remote monitoring in WSO2 ESB, open CARBON_HOME/repository/conf/carbon.xml and locate the following element:
<Ports> <!-- The JMX Ports --> <JMX> <!--The port RMI registry is exposed--> <!--<RMIRegistryPort>9999</RMIRegistryPort>--> <!--The port RMI server should be exposed--> <!--<RMIServerPort>11111</RMIServerPort>--> </JMX> </Ports>
There are two different ports used under JMX configuration. Only if your JMX client application (JConsole, in this case) is behind a firewall, should you uncomment both RMIRegistryPort and RMIServerPort elements. In all other cases, uncommenting the RMIRegistryPort element only is sufficient. In our example, we just uncomment RMIRegistryPort and leave the default port as is.
After configuring the port, save carbon.xml and restart the WSO2 ESB. If remote JMX monitoring is enabled properly, you should see the following INFO log entry in the WSO2 ESB startup console.
INFO - CarbonServerManager JMX Service URL : service:jmx:rmi:///jndi/rmi://10.215.26.176:9999/jmxrmi
2. Connecting to WSO2 ESB using JConsole
Now, we can connect to WSO2 ESB using JConsole with the above JMX Service URL. From any machine which has Sun JDK 1.5 or later, type jconsole in a shell. This will bring up a JConsole "New Connection" screen as follows:
Now, select the Remote Process option and enter the above JMX service URL. Enter the username and the password for the WSO2 ESB administrator user, which should be "admin" and "admin" respectively (default options). Click on Connect once you are done.
The Overview screen will be shown as follows once you have logged into the remote process:
3. Looking at WSO2 ESB specific MBeans
While you can find out statistics about heap memory usage, threads, CPU usage and classes using the above overview screen of JConsole, as these statistics are provided by JVM itself, WSO2 ESB users may require more details about the running server. For example, they may want to know the average time consumed by ESB when transmitting messages, etc. These statistics can be accessed by WSO2 ESB specific MBeans which are already included in WSO2 ESB binary distribution.
To install this added functionality, select the MBeans tab once you logged into the remote JMX process through JConsole. There you can see the org.apache.synapse MBean which can be used to find out key statistics about the live WSO2 ESB instance.
At this point, it will also be interesting to look at some important statistics provided by the org.apache.synapse MBean.
-
Endpoints
If you have named endpoints, these will be listed under Endpoints in org.apache.synapse MBean. You can simply switch on or off endpoints and find out a lot of important information about the endpoints from this particular MBean. This is very useful when your endpoint is suspended due to some reason and you want it to re-activate. In such a situation, you can switch on the suspended endpoint as follows:
-
NhttpTransportLatency
You can find out different views of the latency introduced by ESB in the following way:
-
NhttpConnections
Different metrics on active NHTTP connections can be obtained in the following way:
-
Threading
Useful information about the HTTP client and server workers can be found out in the following way:
Similarly, several additional MBeans can be enabled so as to access even more information about ESB production servers with the methods outlined above.
Also please note that this tutorial assumed that the WSO2 ESB has been started using wso2server.sh or wso2server.bat startup scripts. If you started the server as a daemon, please follow the instructions given in the following two blog posts:
[1]https://maharachchi.blogspot.com/2011/01/monitoring-your-java-application-with.html
[2]https://maharachchi.blogspot.com/2011/02/monitoring-your-java-application-with.html
Author
Charitha Kankanamge
Senior Technical Lead & Manager - QA; WSO2, Inc.