Setting up Service Statistics Data Agent
Service Data Agent is used to collect statistics related to service data from WSO2 service-hosting products (such as WSO2 Application Server (AS), WSO2 Data Services Server (DSS), WSO2 ESB, WSO2 Business Process Server (BPS), WSO2 Business Rules Server (BRS)) and send to the WSO2 CEP server. CEP Server receives data events via its Thrift API. This protocol uses a binary protocol and enables fast data transmission between the service-publishing products and CEP server. Service Data Agent can be configured early so that the statistics to be extracted from service data of the service-publishing product can be pre-defined. In the configuration panel, the user can specify the CEP server (Thrift server) related information and properties to be extracted from services. The user should define the Event Stream related parameters uniquely identified by a name and a version.
Note
The following installation instructions specifically refer to the WSO2 Application Server version 5.x.x. Similar instructions apply to any other service-hosting WSO2 server based on Carbon 4.0.x.
The following sections are covered:
Installing the Feature (This feature is packaged default with WSO2 AS. If required for other servers follow this section.)
1. Download the WSO2 Application Server or any other server you wish to monitor. We will assume WSO2 AS is downloaded and refer to the same as AS for the rest of the document.
2. As we are running both AS and CEP server concurrently we should change the port number of AS by applying an offset. In order to apply an offset, in the AS product directory go to $as_home/repository/conf and open file, carbon.xml. Then change the value in xpath Server/Ports/Offset from 0 to some other integer. For example,
<!-- Ports offset. This entry will set the value of the ports defined below to the define value + Offset. e.g. Offset=2 and HTTPS port=9443 will set the effective HTTPS port to 9445 --> <Offset>2</Offset>
3. To start the server,
- on Linux wso2server.sh
- on MS Windows wso2server.bat
4. In the management console, select "Configure -> Features" and click the "Repository Management" tab. Then select a P2 repository either from a URL or a file. For instructions, refer to section Managing the Feature Repository.
For example,
Then click "Add".
5. Go to "Available Features" tab and select the repository added above. The, click on "Find Features" button. From the list of features that appears, select "BAM Service Data Agent Aggregate" feature and click "Install."
6. Click "Next" and accept the license agreement.
7. Restart the WSO2 AS server. (Go to "Shutdown/restart" sub menu of the "Main" menu in the management console).
Configuring Service Data Agent
1. Go to <WSO2 Application Server home>/repository/conf/etc and open bam.xml file and enable ServiceDataPublishing as follows:
<BamConfig> <ServiceDataPublishing>enable</ServiceDataPublishing> </BamConfig>
This is disabled by default, and CEP publishing won't occur even if you proceed with the rest of the steps if not explicitly enabled.
2. Log in to the Application Server management console and select "Service Data Publishing" from the "Configure" menu.
3. The "Service Data Publisher Configuration" window opens. Fill it appropriately. For example,
Enable Service stats: Tick to get the activity statistics.
Enable Activity Service: This enables message tracing with CEP. Typically, a request is sent to an endpoint after being passed through some intermediate stages. Messaging tracing enables to track each messages and visualize the message body in each of these intermediate stages.
Note
Enable Activity Service feature will be implemented from the next release
Stream Definition Configuration:
- Strea m Na me: Stream Name can be any string with alpha-numeric characters
- Version: Stream Version distinguishes different streams with the same Stream Name. Default version should be 1.0.0 .
- Nick Name: This is a user preferred nick name to the Stream Name in alpha-numeric characters
- Description: A description describing about the particular stream defined by Stream Name, Stream Version pair. Description should also consists of alpha-numeric characters.
BAM Credentials:
- BAM URL: Enter the IP address of the CEP server. And the port should be the thrift port ( ex: tcp://127.0.0.1:7611 ). You can add a comma-separated list of server URLs to ensure that load is distributed among many servers and to minimize effects of a failure of one server node. This load balancing feature is an enhancement of the CEP 2.0.1 release onwards.
- Username: Put the CEP Thrift log-in user name. Default value is admin.
- Password: Put the CEP Thrift log-in password. Default value is admin.
Properties: A CEP deployment can receive events from different data agents. In order to uniquely identify events triggering from one agent, a property can be associated with it. This feature is particularly useful in clustered environment.
Click the "Update" button once done.
Monitoring a Sample Web Service
1. Log in to the Application Server management console and select "Services -> List" in the "Main" menu.
2. In the "Deployed Services" window that opens, click the "TryIt" option of the "HelloService".
3. In the Try It UI, add a sample string as "name" and click the "Send" button.