This documentation is for WSO2 ESB version 4.5.1. View documentation for the latest release.

Monitoring the ESB

WSO2 ESB provides a variety of options to monitor and manage the server runtime, through a number of monitoring tools in its Management Console as well as JMX-based (Java Management Extensions) monitoring. Results provided by these convenient, yet powerful ESB monitoring mechanisms can be used to tune message flows, detect mediation faults and track usage patterns.

The following topics investigate how to monitor WSO2 ESB using Mediation Statistics component and Java Management Extensions (JMX).

Mediation Statistics 

Mediation statistics are widely-used monitoring features. From functional components of the ESB, sequences, proxy services and endpoints directly get involved in processing messages. The Mediation Statistics feature enables a server administrator to collect runtime statistical information on these three types of functional components and view them through the Management Console. This feature provides a simple but effective way of determining the runtime performance of the ESB. The collected statistical data can be used to analyze network traffic patterns and draw rough estimates on how the service bus will be used in the future. Perhaps the most enticing attribute of the mediation statistics feature is that it can be configured in a fine grained manner. In other words, it allows a user to collect data on only a specified set of sequences, proxy services and endpoints.

Mediation Statistics component of WSO2 ESB uses an in-memory data store to keep the collected data. The memory usage of the data store is restricted by the total number of statistics collecting proxy services, sequences and endpoints. If the number of proxy services, sequences and endpoints is constant, the memory usage of the mediation statistics component stays constant. Mediation Statistics component also supports persistence as an optional feature. That is, one may configure the ESB to save statistics to the WSO2 Governance Registry instance that comes embedded with the ESB. Mediation Statistics API allows easy sharing of collected data, among Carbon components. Currently WSO2 Business Activity Monitor (BAM) makes use of this API to access data collected by the service bus. Users can also develop custom data consumers to retrieve mediation statistics from the in-memory data store and process them further, using this API.

Enabling Mediation Statistics

Mediation Statistics feature is available with WSO2 ESB out of the box. You do not have to configure anything to use this feature. Simply sign-in to the Management Console and enable statistics on the sequences, proxy services and endpoints you want to monitor, and the service bus will start collecting data on them. For an example, in order to enable statistics for a sequence, click on Service Bus > Sequences in the left menu and simply click on the Enable Statistics icon corresponding to that sequence.

To enable statistics for a mediation component using the Synapse configuration language, set the value of the "statistics" attribute to "enabled" on the sequence, proxy or endpoint configuration.

Viewing Mediation Statistics

To view the gathered statistics, click Monitor > Mediation Statistics. You will be shown a graphical summary of all collected statistics.

Starting from this view, you can drill down to see more fine grained data such as statistics pertaining to a single sequence or a proxy service. You can even get statistics for different operations on the same endpoint. Click Proxy Service Statistics link in the upper right corner box of the UI shown above to view a summary of Proxy Service Statistics as follows:

Select a proxy service from the "Proxy Services" list shown above to view statistics of that proxy service.

Transport Statistics, System Statistics and System Logs 

WSO2 ESB Management Console provides ways to monitor System Statistics Transport Statistics and System Logs SOAP Tracer and  Mediation Tracer are some additional monitoring tools provided by WSO2 ESB.

JMX Monitoring 

WSO2 ESB exposes number of management resources as JMX MBeans that can be used for managing and monitoring the running server. These MBeans can be accessed remotely using a JMX client such as JConsole. When WSO2 ESB is starting up, it will display the JMX Service URL in the console as follows.

INFO - JMXServerManager JMX Service URL :         service:jmx:rmi://localhost:11111/jndi/rmi://localhost:9999/jmxrmi

This URL can be used to remotely access the JMX Service exposed by WSO2 ESB. In this guide, we will use JConsole as the JMX client to access this service.

Using JConsole for JMX Monitoring

Start JConsole and enter the above URL as the JMX Service URL. Type "admin" in both username and password fields and click "Connect".

After successfully connecting to the JMX service, click on "MBeans" tab of JConsole to view MBeans exposed by the ESB. As shown in Figure 6, these are listed under org.apache.axis2 and org.apache.synapse nodes. The following section summarizes the attributes and operations available in MBeans exposed by the WSO2 ESB.

Attributes and Operations of MBeans

Transport related MBeans: For each transport listener and sender enabled in the ESB, there will be an MBean under org.apache.axis2/Transport node which has following attributes and operations. For example, when http and https transports are enabled following MBeans will be exposed.

  • org.apache.axis2/Transport/nio-http-listener
  • org.apache.axis2/Transport/nio-http-sender
  • org.apache.axis2/Transport/nio-https-listener
  • org.apache.axis2/Transport/nio-https-sender
Attribute/Operation NameDescription
ActiveThreadCountThreads active in this transport listener/sender.
AvgSizeReceivedAverage size of received messages.
AvgSizeSentAverage size of sent messages.
MaxSizeReceivedMaximum message size of received messages.
MaxSizeSentMaximum message size of sent messages.
MinSizeReceivedMinimum message size of received messages.
MinSizeSentMinimum message size of sent messages.
MessagesReceivedTotal number of messages received through this transport.
MessagesSentTotal number of messages sent through this transport.
FaultsReceivingNumber of faults encountered while receiving.
FaultsSendingNumber of faults encountered while sending.
BytesReceivedNumber of bytes received through this transport.
BytesSentNumber of bytes sent through this transport.
QueueSizeNumber of messages currently queued. Messages get queued if all the worker threads in this transport thread pool are busy.
ResponseCodeTableNumber of messages sent against their response codes.
TimeoutsReceivingMessage receiving timeout.
TimeoutsSendingMessage sending timeout.
LastResetTimeLast time transport listener/sender statistic recording was reset.
MetricsWindowTime difference between current time and last reset time in milliseconds.
resetStatistics()Clear recorded transport listener/sender statistics and restart recording.
start()Start this transport listener/sender.
stop()Stop this transport listener/sender.
pause()Pause this transport listener/sender which has been started.
resume()Resume this transport listener/sender which is currently paused.
maintenenceShutdown(long gracePeriod)Stop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenence.

Latency related MBeans:

  • org.apache.synapse/NHTTPLatencyView/nio-http
  • org.apache.synapse/NHTTPLatencyView/nio-https
  • org.apache.synapse/NHTTPS2SLatencyView/nio-http
  • org.apache.synapse/NHTTPS2SLatencyView/nio-https
Attribute/Operation NameDescription
AllTimeAvgLatencyAverage latency since latency recording was last reset.
LastXxxAvgLatencyAverage latency for last Xxx time period. For example, LastHourAvgLatency return the average latency for last hour.
LastResetTimeLast time latency statistic recording was reset.
reset()Clear recorded latency statistics and restart recording.

NttpConnections related MBeans:

  • org.apache.synapse/NhttpConnections/http-listener
  • org.apache.synapse/NhttpConnections/http-sender
  • org.apache.synapse/NhttpConnections/https-listener
  • org.apache.synapse/NhttpConnections/https-sender
Attribute/Operation NameDescription
ActiveConnectionsNumber of currently active connections.
ActiveConnectionsPerHostsA map of number of connections against hosts.
LastXxxConnectionsNumber of connections created during last Xxx time period.
RequestSizesMapA map of number of requests against their sizes.
ResponseSizesMapA map of number of responses against their sizes.
LastResetTimeLast time connection statistic recordings was reset.
reset()Clear recorded connection statistics and restart recording.

Threading related MBeans:

  • org.apache.synapse/Threading/HttpClientWorker
  • org.apache.synapse/Threading/HttpServerWorker
Attribute/Operation NameDescription
TotalWorkerCountTotal worker threads related to this server/client.
AvgUnblockedWorkerPercentageTime-averaged unblocked worker thread percentage.
AvgBlockedWorkerPercentageTime-averaged blocked worker thread percentage.
LastXxxBlockedWorkerPercentageBlocked worker thread percentage averaged for last Xxx time period.
DeadLockedWorkersNumber of deadlocked worker threads since last statistics reset.
LastResetTimeLast time thread statistic recordings was reset.
reset()Clear recorded thread statistic and restart recording.

SNMP Monitoring

Simple Network Management Protocol (SNMP) is an Internet-standard protocol for managing devices on IP networks. Given below is how to configure SNMP in WSO2 ESB, which exposes various MBeans via SNMP.  

1. Download the following jar files from http://www.snmp4j.org and add to <carbon_home>/repository/components/lib.

  • snmp4j-2.1.0.jar
  • snmp4j-agent-2.0.6.jar
2. Enable SNMP in repository/conf/synapse.properties file by adding the following entry.

 

synapse.snmp.enabled=true

3. This enabled the ESB server to monitor MBeans with SNMP. For example:

Monitoring Info : OID branch "1.3.6.1.4.1.18060.14" with the following sub-branches:1 - ServerManager MBean

2- Transport MBeans

3 - NHttpConnections MBeans

4 - NHTTPLatency MBeans

5 - NHTTPS2SLatency MBeans