Documentation

##### WSO2 WSAS 2.2-RC1

- Release Notes
- Contents
- Home

##### Downloads

- Releases

##### Documentation

- User Guide
- FAQs
- Installation Guide
- Source
- Running Behind a Proxy
- Data Services Guide
  - RDBMS Data Source
  - CSV Data Source
  - Excel Data Source
  - JNDI Data Source
- EJB Guide
- Clustering Guide
- JMX Guide
- XKMS Guide
- Changing Keys

##### Samples

- Chad
- Commodity Quote
- Data Services
- Flickr
- Javascript
- Jaxws
- JiBX
- Mtom
- STS
- Trader
- Tiny URL
- Metadata Exchange
- WS-Transfer
- XML Key Managment Specification
- Cluster Management

##### API Documentation

- Java Docs

##### Tools

- Code Generation
- Change Password
- Eclipse IDE Integration
- TCP Monitor
- WSDL2Code
- WSDL View
- Try It
- AAR Validation
- MAR Validation

##### Resources

- News

##### Get Involved

- Mailing Lists
- Integration

##### Project Information

- Project Team
- Issue Tracking
- License

[ Download ] | [ Documentation Home ] | [ Release Note ]

# JMX Based Monitoring

Contents

- Introduction
- Using jconsole to Manage & Monitor WSAS

## Introduction

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(s) in your application, you will write an MBean that defines its management interface, and 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. The first version of JMX based monitoring is available in this release. Some of the monitoring & management capabilities available in the Management Console have also been exposed via JMX.

## Using jconsole to Manage & Monitor WSAS

This section introduces some of the MBeans in WSAS and their usages. We will use jconsole which ships with J2SDK 1.5 and newer version in the course of this article. Please

As shown in the image above, when WSAS is started, if JMX has been enabled, the JMX Service URL will be displayed. The default URL is service:jmx:rmi:///jndi/rmi://<your-ip>:9999/server. From the command line, you can start jconsole by typing jconsole service:jmx:rmi:///jndi/rmi://<your-ip>:9999/server . Now the jconsole window will be available as shown below. 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 for looging in, in the Management Console. Any user having the admin role can login to JMX.

Here is the first window you will see when you login.

Click on the MBeans tab and you will see the org.wso2.wsas domain, which will contain some MBeans as shown below.

## ServerAdmin MBean

The ServerAdmin MBean is used for administering the WSAS server instance

The above screen shows the Server attributes such as the ServerStatus, ServerData & ServerVersion. The ServerStatus can be either RUNNING, SHUTTING_DOWN, RESTARTING or IN_MAINTENANCE.

The above screen shows the operations available in the ServerAdmin MBean.

- 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.

## ServiceAdmin MBean

The ServiceAdmin MBean is used for adminsitering services deployed on WSAS The above screen shows the attributes:

- 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 above screen shows the operations available in the ServiceAdmin MBean.

- 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 MBean is used for monitoring system and server statistics The above screen shows the attributes:

- 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

The above screen shows the operations available in the Statistics MBean.

- 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.

## Enabling and Disabling JMX

In the WSO2WSAS_HOME/conf/server.xml, commenting out the JMX port will disable JMX while uncommenting or adding this entry will enable JMX. Here is the relevant section is the server.xml file:

                <!--
                Ports used by WSAS
                -->
                <Ports>
                <!--
                Uncomment this section and provide the correct HTTP port
                in the case of a generic server installation
                -->
                <!--
                <HTTP>9762</HTTP>
                -->

                <!--
                Uncomment this section and provide the correct HTTPS port
                in the case of a generic server installation
                -->
                <!--
                <HTTPS>9443</HTTPS>
                -->

                <!--
                The JMX Port
                -->
                <JMX>9999</JMX>

                <!--
                Port for listening to external commands such as START, STOP, RESTART
                -->
                <CommandListener>6666</CommandListener>
                </Ports>

## Changing the JMX Port

In the WSO2WSAS_HOME/conf/server.xml, locate the JMX port and change it. Here is the relevant section in the server.xml file:

                <!--
                Ports used by WSAS
                -->
                <Ports>
                <!--
                Uncomment this section and provide the correct HTTP port
                in the case of a generic server installation
                -->
                <!--
                <HTTP>9762</HTTP>
                -->

                <!--
                Uncomment this section and provide the correct HTTPS port
                in the case of a generic server installation
                -->
                <!--
                <HTTPS>9443</HTTPS>
                -->

                <!--
                The JMX Port
                -->
                <JMX>9999</JMX>

                <!--
                Port for listening to external commands such as START, STOP, RESTART
                -->
                <CommandListener>6666</CommandListener>
                </Ports>