Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Follow the instructions below to set up BAM to be used with the WSO2 API Manager.

Info
titleNote
  • Throughout this chapter, <AM_HOME> refers to the API Manager installation directory whereas, <BAM_HOME> refers to the Business Activity Monitor installation directory.
  • The data sources and databases in this guide are used only as examples. They may vary depending on your configurations.

1. Download WSO2 BAM 2.0 from location: http://wso2.com/products/business-activity-monitor.

...

2. Enable API tracking option by setting the "APIUsageTracking" element to true in <AM_HOME>/repository/conf/api-manager.xml  file as follows.xml and specify the data source name to be used for getting BAM statistics. For example:

Code Block
languagehtml/xml
<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>

 

3. Restart the API Manager.

...

5. Specify the data source definition used in the above configuration in <AM_HOME>\repository\conf\datasourcesmaster-datasources.xml file as shown below. The <Name>WSO2AM_STATS_DB</Name> XML node defines the datasource used to fetch analytical data. An H2 database is used in this example.

Code Block
languagehtml/xml
<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>

...

Code Block
languagehtml/xml
<datasource>
       <name>WSO2AM_STATS_DB</name>
       <description>The datasource used for getting statistics to API Manager</description>
       <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>

 

 

 

 

 

 

 

 

 

 

 

 

9. Start WSO2 BAM server by running <BAM_HOME>/bin/wso2server.[sh/bat].

10. If you want to host the BAM server on a different machine or change the running port, you must edit file api-manager.xml located at the <APIUsageTracking> node in <AM_HOME>/repository/conf folder. Edit the APIUsageTracking block /api-manager.xml file as follows:

Code Block
languagehtml/xml
<!--API usage tracker configuration used by the BAM data publisher in API gateway.-->
    <APIUsageTracking>
        <!-- Enable/Disable the API usage tracker.-->
        <Enabled>true</Enabled>

        <!-- API Usage Data Publisher.-->
        <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass>

        <!--Thrift port of the remote BAM server.-->
        <ThriftPort>7612</ThriftPort>

        <!-- Server URL of the remote BAM server used to collect statistics. Must be specified in protocol://hostname:port/ format.-->
        <BAMServerURL>https://localhost:9444/</BAMServerURL>

        <!--Administrator username to login to the remote BAM server.-->
        <BAMUsername>admin</BAMUsername>

        <!--Administrator password to login to the remote BAM server.-->
        <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>

Once the WSO2 BAM is configured to render and produce statistics of APIs hosted and managed in the API Manager, you can view them through various statistical dashboards in the API Publisher, depending on the permission levels of the login. For information, refer to section Viewing API Statistics.

Excerpt
hiddentrue

Instructions to configure WSO2 API Manager monitoring and statisticsto generate statistical data and pass them over to WSO2 BAM for summarization and analysis.