In this This chapter we explain explains how to set up WSO2 Business Activity Monitor (BAM) to render API statistics. collect and analyze runtime statistics from the WSO2 API Manager. To publish data from the API Manager to BAM, the Thrift protocol is used. Information processed in BAM is stored in a database from which the API Publisher retrieves information before displaying in the corresponding UI screens.
Follow the instructions below to set up BAM to be used with the WSO2 API Manager. Throughout this chapter, <AM_HOME> refers to the API Manager installation directory whereas, <BAM_HOME> refers to the Busienss Business Activity Monitor installation directory.
1. Download WSO2 BAM 2.0 from location: http://wso2.com/products/business-activity-monitor.
Info | ||
---|---|---|
| ||
For WSO2 API Manager 1.1.0 version, WSO2 BAM 2.0.0 is required. |
2.
2. Open the file api-manager.xml at location <AM_HOME>/\repository/\conf folder.
3. Enable its API tracking option by setting the "APIUsageTracking" element to true as follows:
Code Block | ||
---|---|---|
| ||
<APIUsageTracking> <!-- Enable/Disable the API usage tracker. --> <Enabled>true</Enabled> <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass> <ThriftPort>7612</ThriftPort> <BAMServerURL>tcp://localhost:7612/</BAMServerURL> <BAMUsername>admin</BAMUsername> <BAMPassword>admin</BAMPassword> <!-- JNDI name of the data source to be used for getting BAM statistics. This data source should be defined in the master-datasources.xml file in conf/datasources directory. --> <DataSourceName>jdbc/WSO2AM_STATS_DB</DataSourceName> </APIUsageTracking> |
4. Configure the data source definition used in the above configuration in <AM_HOME>\repository\conf\datasourcesmaster-datasources.xml file.
Code Block | ||
---|---|---|
| ||
<datasource>
<name>WSO2AM_STATS_DB</name>
<description>The datasource used for getting statistics to API Manager</description>
<jndiConfig>
<!-- This jndi name should be same as the DataSourceName defined in api-manager.xml -->
<name>jdbc/WSO2AM_STATS_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<!-- JDBC URL to query the database -->
<url>jdbc:h2:<BAM_HOME>/repository/database/APIMGTSTATS_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> |
4. Restart the API Manager.
...