Monitoring Carbon using a remote JMX client

  • By Rajika Kumarasiri
  • |
  • 4 Oct, 2010

WSO2 Carbon which is the underline frame work for WSO2 ESB(and other products) now can be monitored using a remote JMX client(such as JConsole) which is behind a firewall. To enable this feature following two properties should be uncommented from the carbon.xml


  <!-- The JMX Ports -->
         <!--The port RMI registry is exposed-->
         <!--The port RMI server should be exposed-->

These parameters also can be passed at server start up time using the system propertis "com.wso2.rmiserver.port" and "com.sun.management.jmxremote.port" for RMIServer port and the RMIRegistry port respectively.When monitoring Carbon remotely specifying the RMIRegistry port is sufficient but if your client is behind a firewall you'll also need to specify the second port, RMIServer port. This second port need to be opened by the firewall admin.

Following code fragment is from CarbonServerManager.java which shows how the JMX url is constructed according to provided port.

// Create an RMI connector and start it
if (rmiServerPortString != null) {
      int rmiServerPort = Integer.parseInt(rmiServerPortString);
      jmxURL = "service:jmx:rmi://" + NetworkUtils.getLocalHostname() + ":" +
                rmiServerPort + "/jndi/rmi://" + NetworkUtils.getLocalHostname() + ":" +
                            rmiRegistryPort + "/jmxrmi";
} else {
      jmxURL = "service:jmx:rmi:///jndi/rmi://" +
                NetworkUtils.getLocalHostname() + ":" + rmiRegistryPort + "/jmxrmi";
JMXServiceURL url = new JMXServiceURL(jmxURL);

With this improvment you'll be able to monitor any carbon based product using a JMX client which is behind a firewall.


Rajika Kumarasiri, Senior Sofware Engineer,WSO2 Inc


About Author

  • Rajika Kumarasiri
  • Senior Software Engineer
  • WSO2 Inc.