...
- Java Development Kit/JRE version 1.6.* or 1.7.*. Also see Installation Prerequisites.
- Download and install WSO2 BAM 2.4.1 or later using the instructions given in BAM Installation Guide: docs.wso2.org/business-activity-monitor/Getting+Started.
Building and running the sample
...
- Open
<BAM_HOME>/repository/conf/carbon.xml
file where <BAM_HOME> is the BAM binary distribution folder that was downloaded as a prerequisite above. Change the carbon.xml file's port offset to 1. This is done to avoid any port conflicts of running two WSO2 Carbon instances in the same machine.<Offset>1</Offset>
Copy the
API_Manager_Analytics.tbox
in<APIM_HOME>/samples/Billing
folder to<BAM_HOME>/repository/deployment/server/bam-toolbox
folder. Create thebam-toolbox
directory, if it doesn't exist already.Note If you copied have
API_Manager_Analytics.tbox
to <APIMthe<BAM_HOME>/statistics
folder earlierbefore, then you have to uninstall it first and install the new toolbox through the BAM Admin Console. Else, the hive Hive script used to summarize data on a monthly basis will not get executed.The API Manager Analytic Toolbox : A toolbox is an installable archive, with a .tbox extension. It contains necessary artifacts that models a complete usecase, from collecting data, analyzing through defined Hive scripts to summarizing data through gadgets, Jaggery scripts and other dashboard components.
- Configure a database to which BAM can write analyzed information to.
Add the following code segment to
<BAM_HOME>/repository/conf/datasources/master-datasources.xml
file. Specify the data source definition in Connect the datasource to the database where the analytical data is stored using the<BAM_HOME>/repository/conf/datasources/master-datasources.xml
file as follows. In the example,WSO2AM_STATS_DB
is the datasource used to fetch the analytical data . This example uses stored in an H2 database. If you want to use a different database, see Changing the statistics database.Code Block language html/xml <datasource> <name>WSO2AM_STATS_DB</name> <description>The datasource used for getting statistics to API Manager</description> <jndiConfig> <name>jdbc/WSO2AM_STATS_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <!-- JDBC URL to query the database --> <url>jdbc:h2: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>
Because you changed the default BAM port in step 2 above, you must change the Cassandra port given in JDBC connection url in the following datasource configuration found in bam-datasources.xml file. (For In WSO2 BAM 2.4.0, this is done in
master-datasources.xml
). Since the port offset is 1, the Cassandra port must be 9161.
For a list of default ports used by WSO2 products, see Default Ports of WSO2 Products.Code Block language html/xml <datasource> <name>WSO2BAM_CASSANDRA_DATASOURCE</name> <description>The datasource used for Cassandra data</description> <definition type="RDBMS"> <configuration> <url>jdbc:cassandra://localhost:9161/EVENT_KS</url> <username>admin</username> <password>admin</password> </configuration> </definition> </datasource>
Note If you run the Hive scripts before changing the default Cassandra port according to the BAM port offset, you keep getting an exception. To overcome this, add the following line at the beginning of the Hive script and rerun.
drop table <hive_cassandra_table_name>;
Change Add the port to Cassandra port in <BAMthe
<Nodes>
element of the<BAM_HOME>/repository/conf/etc/hector-config.xml
file. This is defined in <Nodes> element- Start WSO2 BAM server by running
wso2server.bat
(on Windows) andwso2server.sh
(on Linux)
Configuring API Manager
...