Activity Monitoring Toolbox
The Activity Monitoring 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 such as WSO2 ESB, WSO2 Application Server, WSO2 Data Services Server.
Explained below is a complete sample 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 use case
- Download and start WSO2 BAM and log in to its management console. Instructions are given in section Getting Started.
Set up BAM Service Statistics Data Agent or BAM Mediator in a service-hosting WSO2 product. In this example, we use WSO2 ESB. Follow the instructions in BAM Mediator. Alternatively, you can pump some sample service statistics by running
ant
command in$bam_home /samples/activity-monitoring
folder.
You can give custom values in parameters for Data receiver URL, user name and password. Default values 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
Activity monitoring toolbox that comes with this sample is using the embedded H2 database to persist summarized data. It only works with a default BAM installation. Therefore, if you change the default settings (such as port offset and h2 database), you have to change Hive script accordingly. For example, if you offset the default BAM port, update the Cassandra port of the Hive script accordingly:
cassandra.port = 9161
.
Installing the toolbox
- Log in to BAM's management console and select Add under BAM Toolbox in the Main menu.
- The Add Tool Box page appears.
- Select the
Activity Monitoring Toolbox
and Install. It deploys all required artifacts to BAM.
You might have to wait a few seconds and refresh the page to see the status as Installed.
Executing the analytics scripts
- After installing the toolbox, navigate to List under Analytics in the Main menu.
- When installing the toolbox, an analytics script is added as follows. Click the Execute link associated with it to display statistics on the dashboard.
But, if you are sending data through BAM mediator, then edit this script and use the stream name of BAM mediator for cassandra.cf.name value and then execute.
Configure summarized database
You can configure a summarized database in <BAM_HOME>/repository/conf/datasources/master-datasources.xml
file as follows:
<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>
You can also configure the Cassandra datasource in the Hive script in master-datasources.xml.
Displaying statistics on dashboard
- After running the Hive script, clickDashboard in the Main menu.
- The dashboard displays all activity IDs received during a given date-time range and for selected Server, Service and Operation. For example
- Click Explore to view all messages related to a specific activity ID in a given selection criteria. Error messages appear highlighted in red. Data other than header, body and host address appear when you click the green Explore button.