Mediation Statistics Toolbox
The "Mediation Statistics Toolbox" is a default, out-of-the-box toolbox provided by WSO2 BAM for point-and-click installation. It includes the necessary artifacts (hive scripts, data stream definitions, properties files, gadgets etc.) required to collect and monitor activity related to services deployed in any WSO2 service-hosting product like the WSO2 Enterprise Service Bus, WSO2 Application Server, WSO2 Data Services Server etc.
Explained below is a complete, example use case of how to extract and summarize service statistics of the WSO2 Application Server using this toolbox. The following sections are covered:
- Prerequisites of the Usecase
- Installing the Toolbox
- Executing the Analytics Scripts
- Displaying Statistics on Dashboard
Prerequisites of the Usecase
- Download and start the WSO2 BAM server and log in to its management console. Instructions are given in section Getting Started.
- Set up the BAM Mediation Statistics Data Agent. For instructions on setting it up to transfer service data to WSO2 BAM, see Setting up Mediation Stat Data Agent.
- Publish data to WSO2 BAM using the BAM Mediation Statistics Data Agent you set up. For instructions on publishing data, see Setting up Mediation Stat Data Agent. Else, you can run the mediation stats sample to publish data to WSO2 BAM, by executing the following command in the CLI:
ant <BAM_HOME>/samples/mediation-stats
You can give custom values for parameters for Data receiver URL, user name and password. Default values of them are as follows.
Parameter | Default Value |
---|---|
URL | tcp://localhost:7611 |
User Name | admin |
Password | admin |
Now lets see how new values can be given as parameters
Parameter | New Value |
---|---|
URL | tcp://localhost:7612 |
User Name | user |
Password | pass123 |
Command with new values : ant -Durl=tcp://localhost:7612 -Dusername=user -Dpassword=pass123
Installing the Toolbox
1. Log in to BAM's management console and select "BAM Toolbox -> Add" in the "Main" menu.
2. The "Add Tool Box" page appears. Select the "Mediation Stats Monitoring Toolbox" and click "Install" button. With this simple step, all required artifacts will be deployed to BAM.
3. The "Available BAM Tool Boxes" page opens with the installation status as "Installing". Wait a few seconds and refresh the page to see the status changed to "Installed".
Executing the Analytics Scripts
1. After installing the toolbox, navigate to "Analytics -> List" in the "Main" menu.
2. When installing the Toolbox, an analytics script is added for execution. It can simply be executed to display statistics on the dashboard. Click the "Execute" link associated with it.
Configure Summarized Database.
Summarized database can be configured from bam-datasources.xml
in WSO2BAM/repository/conf/datasources/ directory. You need to change the following section
<datasource> <name>WSO2BAM_DATASOURCE</name> <description>The datasource used for analyzer data</description> <definition type="RDBMS"> <configuration> <url>jdbc:h2:repository/database/samples/BAM_STATS_DB;AUTO_SERVER=TRUE</url> <username>wso2carbon</username> <password>wso2carbon</password> <driverClassName>org.h2.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Cassandra datasource in hive script also can be configured from bam-datasources.xml
.
Displaying Statistics on Dashboard
1. After running the hive script, navigate to "Dashboard" in the "Main" menu.
2. You should be able to see visualized data of a particular service deployed in the WSO2 ESB. For example,