Java Management Extensions (JMX) is a technology that lets you implement management interfaces for Java applications. A management interface, as defined by JMX, is composed of named objects called MBeans (Management Beans). MBeans are registered with a name (an ObjectName) in an MBeanServer. To manage a resource or many resource in your application, write an MBean that defines its management interface. Then register that MBean in your MBeanServer. The content of the MBeanServer can then be exposed through various protocols, implemented by protocol connectors, or protocol adaptors.
JMX is enabled in WSO2 Carbon by default. Therefore, the WSO2 Application Server facilitates JMX-based monitoring. Some of the monitoring and management capabilities available in the Application Server's Management Console are also exposed via JMX.
You can change the JMX configuration by editing the jmx.xml file, which is inside <AS_HOME>/repository/conf/etc directory. You can configure JMX ports, RMIRegistryPort and RMIServerPort from the "Ports" section of the carbon.xml, which is in <AS_HOME>/repository/conf directory.
Code Block |
---|
<JMX>
<!--The port RMI registry is exposed-->
<RMIRegistryPort>9999</RMIRegistryPort>
<!--The port RMI server should be exposed-->
<RMIServerPort>11111</RMIServerPort>
</JMX>
|
If JMX is enabled, when the server starts up, it will print the JMX Server URL on the console as follows.
Code Block |
---|
INFO {org.wso2.carbon.core.init.CarbonServerManager} - JMX Service URL : service:jmx:rmi://<your-ip>:11111/jndi/rmi://<your-ip>:9999/jmxrmi
|
Using 'jconsole' to Manage and Monitor the WSO2 Application Server
Jconsole is a JMX-compliant monitoring tool. It comes with the Jave JConsole is a JMX-compliant monitoring tool, which comes with the Java Development Kit (JDK) 1.5 and newer versions and can be found in <JDK_HOME>/bin/
directory. For information on installing JDK, refer to Installing JDK on Windows, Linux or Solaris.
You can start the tool by simply typing jconsole in a command (shell) prompt from <JDK_HOME>/bin.
Once the console is opened, you can connect to Carbon by providing the following URL as the Remote Process URL. You can type in the default username and password combination admin/admin to login. Note that this is the same administrator account that is used to log into the Application Server's the Management Console. Any user having the admin role can login to JMX.
The "Jave Monitoring & Management Console" opens. The first window you see looks similar to the following:
Click on the "MBeans" tab to see the "org.wso2.carbon" domain, which contains some MBeans as follows:
The ServerAdmin MBean
The ServerAdmin MBean is used for administering the Application Server instance.
There are several Server attributes such as the "ServerStatus", "ServerData" and "ServerVersion". The "ServerStatus" attribute can take any of the following values:
- RUNNING
- SHUTTING_DOWN
- RESTARTING
- IN_MAINTENANCE
The ServerAdmin MBean has the following operations:
- shutdown - forcefully shutdown the server
- restart - forcefully restart the server
- restartGracefully - wait till all current requests are served and then restart
- shutdownGracefully - wait till all current requests are served and then shutdown
- startMaintenance - switch the server to maintenance mode. No new requests will be accepted while the server is in maintenance
- endMaintenance - switch the server to normal mode, if it was switched to maintenance mode earlier.
The ServiceAdmin MBean
The ServiceAdmin or later versions. Therefore, when you use a WSO2 product, JMX is enabled by default, which allows you to monitor the product using JConsole. When you start JConsole, the MBeans tab will show the MBeans generated for your product. While some of these MBeans (ServerAdmin and DataSource) are common to all WSO2 products, some MBeans are specific to WSO2 DSS.
Info |
---|
Go to the WSO2 administration guide for detailed instructions on how to configure JMX for a WSO2 product, how to use JConsole for monitoring a product and for descriptions of the common MBeans used by all WSO2 products. |
Listed below are the MBeans that are specific to WSO2 DSS.
Table of Contents |
---|
ServiceAdmin MBean
This MBean is used for administering services deployed in the Application ServerDSS. Its attributes are as follows:
Attribute | Description |
---|---|
NumberOfActiveServices |
...
The number of services which can currently serve requests. | |
NumberOfInactiveServices |
...
The number of services which have been disabled by an administrator. | |
NumberOfFaultyServices |
...
The number of services which are faulty. |
The operations available in the ServiceAdmin MBean:
Operation | Description |
---|---|
startService(p1:string) |
...
The p1 parameter is the service name. You can activate a service using this operation. | |
stopService(p1:string) |
...
The p1 parameter is the service name. You can deactivate/disable a service using this operation. |
...
Statistics MBean
The Statistics This MBean is used for monitoring system and server statistics. Its attributes are as follows:
Attributes | Description |
---|---|
AvgSystemResponseTime |
...
The average response time for all the services deployed in the system. The beginning of the measurement is the time at which the server started. | |
MaxSystemResponseTime |
...
The maximum response time for all the services deployed in the system. The beginning of the measurement is the time at which the server started. | |
MinSystemResponseTime |
...
The minimum time for all the services deployed in the system. The beginning of the measurement is the time at which the server started. | |
SystemFaultCount |
...
The total number of faults that occurred in the system since the server was started. | |
SystemRequestCount |
...
The total number of requests that has been served by the system since the server was started. | |
SystemResponseCount |
...
The total number of response that has been sent by the system since the server was started. |
operations Operations available in the Statistics MBean:
Operation | Description |
---|---|
getServiceRequestCount(p1:string) |
...
The p1 parameter is the service name. You can get the total number of requests received by this service since the time it was deployed, using this operation. | |
getServiceResponseCount(p1:string) |
...
The p1 parameter is the service name. You can get the total number of responses sent by this service since the time it was deployed, using this operation. | |
getServiceFaultCount(p1:string) |
...
The p1 parameter is the service name. You can get the total number of fault responses sent by this service since the time it was deployed, using this operation. | |
getMaxServiceResponseTime(p1:string) |
...
The p1 parameter is the service name. You can get the maximum response time of this service since deployment. | |
getMinServiceResponseTime(p1:string) |
...
The p1 parameter is the service name. You can get the minimum response time of this service since deployment. | |
getAvgServiceResponseTime(p1:string) |
...
The p1 parameter is the service name. You can get the average response time of this service since deployment. | |
getOperationRequestCount(p1:string, p2:string) |
...
The p1 parameter is the service name. The p2 parameter is the operation name. You can get the total number of requests received by this operation since the time its service was deployed, using this operation. | |
getOperationResponseCount(p1:string, p2:string) |
...
The p1 parameter is the service name. The p2 parameter is the operation name. You can get the total number of responses sent by this operation since the time its service was deployed, using this operation. | |
getOperationFaultCount(p1:string, p2:string) |
...
The p1 parameter is the service name. The p2 parameter is the operation name. You can get the total number of fault responses sent by this operation since the time its service was deployed, using this operation. | |
getMaxOperationResponseTime(p1:string, p2:string) |
...
The p1 parameter is the service name. The p2 parameter is the operation name. You can get the maximum response time of this operation since deployment. | |
getMinOperationResponseTime(p1:string, p2:string) |
...
The p1 parameter is the service name. The p2 parameter is the operation name. You can get the minimum response time of this operation since deployment. | |
getAvgOperationResponseTime(p1:string, p2:string) |
...
The p1 parameter is the service name. The p2 parameter is the operation name. You can get the average response time of this operation since deployment. |