Versions Compared

Key

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

...

  1. Download WSO2 Business Activity Monitor.
  2. Install Oracle Java SE Development Kit (JDK) version 1.6.24 or later or 1.7.*.
  3. Set the JAVA_HOME environment variable.
  4. Using the command line, navigate to <BAM_HOME>/bin, and execute the following command: wso2server.bat (for Windows) or wso2server.sh (for Linux).
  5. Wait until you see the message "WSO2 Carbon started in 'n' seconds." 
    It indicates that the server started successfully. To stop the API ManagerWSO2 BAM, simply hit Ctrl-C in the command window.
  6. Copy the URL of the BAM management console from the terminal output, which will be displayed as follows, and access it using your web browser.

    Mgt Console URL: https://10.100.5.72:9444/carbon/

...

  1. Execute the below query, to create a new RDBMS table to summarize data minute-wise and to store them in a separate RDBMS table.

    Code Block
    languagesql
    CREATE EXTERNAL TABLE IF NOT EXISTS requestInfoStatsPerMinute (server STRING, request_path STRING, year SMALLINT, month SMALLINT, day SMALLINT, hour SMALLINT, minute SMALLINT, total_hit INT)
    STORED BY 'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES (
    'wso2.carbon.datasource.name'='WSO2BAM_DATASOURCE',
    'hive.jdbc.update.on.duplicate' = 'true',
    'hive.jdbc.primary.key.fields' = 'server,request_path,year,month,day,hour,minute',
    'hive.jdbc.table.create.query' = 'CREATE TABLE REQUEST_INFO_SUMMARY_PER_MINUTE (server VARCHAR(50), request_path VARCHAR(150), year SMALLINT, month SMALLINT, day SMALLINT, hour SMALLINT, minute SMALLINT, total_hit INT)');
  2. Execute the below query, to get data from Cassandra column family and then group the data (by server, request_path, year, month, day, hour and minute), and to insert those values into the REQUEST_INFO_SUMMARY_PER_MINUTE table.

    Code Block
    languagesql
    insert overwrite table requestInfoStatsPerMinute 
    select server, request_path, substr(time,1,4) as year, substr(time,6,2) as month,substr(time,9,2) as day, substr(time,12,2) as hour, substr(time,15,2) as minute, count(*) as total_hit
    from mappingRequestInfoTable 
    group by server,request_path,substr(time,1,4), substr(time,6,2),substr(time,9,2),substr(time,12,2),substr(time,15,2);
  3. Execute the below query, to create a new virtual Hive table to get data from the REQUEST_INFO_SUMMARY_PER_MINUTE table, which is already summarized.

    Info

    In summarizing data based on hourly usage,you don’t need to do get data again from Cassandra column family since now you already have summarizing data based on minutes,

    Code Block
    languagesql
    CREATE EXTERNAL TABLE IF NOT EXISTS requestInfoStatsPerMinuteDataFetcher (server STRING, request_path STRING, year SMALLINT, month SMALLINT, day SMALLINT, hour SMALLINT, minute SMALLINT, total_hit INT)
    STORED BY 'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES ( 
    'wso2.carbon.datasource.name'='WSO2BAM_DATASOURCE',
    'mapred.jdbc.input.table.name' = 'REQUEST_INFO_SUMMARY_PER_MINUTE');
  4. Execute the below query, to create hourly based summarized data table in the RDBMS

    Code Block
    languagesql
    CREATE EXTERNAL TABLE IF NOT EXISTS requestInfoStatsPerHour (server STRING, request_path STRING, year SMALLINT, month SMALLINT, day SMALLINT, hour SMALLINT, total_hit INT)
    STORED BY 'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES ( 
    'wso2.carbon.datasource.name'='WSO2BAM_DATASOURCE',
    'hive.jdbc.update.on.duplicate' = 'true',
    'hive.jdbc.primary.key.fields' = 'server,request_path,year,month,day,hour',
    'hive.jdbc.table.create.query' = 'CREATE TABLE REQUEST_INFO_SUMMARY_PER_HOUR ( server VARCHAR(50), request_path VARCHAR(150), year SMALLINT, month SMALLINT, day SMALLINT, hour SMALLINT, total_hit INT)' );
  5. Execute the below query, to get data from minute-wise summarized table and to insert into the hourly based table after processing the data.

     

    Code Block
    languagesql
    insert overwrite table requestInfoStatsPerHour 
    select server, request_path, year, month, day, hour, sum(total_hit) as total_hit
    from requestInfoStatsPerMinuteDataFetcher 
    group by server,request_path,year,month,day,hour;
    
    CREATE EXTERNAL TABLE IF NOT EXISTS requestInfoStatsPerHourDataFetcher (server STRING, request_path STRING, year SMALLINT, month SMALLINT, day SMALLINT, hour SMALLINT,  total_hit INT)
    STORED BY 'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES ( 
    'wso2.carbon.datasource.name'='WSO2BAM_DATASOURCE',
    'mapred.jdbc.input.table.name' = 'REQUEST_INFO_SUMMARY_PER_HOUR');
    CREATE EXTERNAL TABLE IF NOT EXISTS requestInfoStatsPerDay (server STRING, request_path STRING, year SMALLINT, month SMALLINT, day SMALLINT, total_hit INT)
    STORED BY 'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES ( 
    'wso2.carbon.datasource.name'='WSO2BAM_DATASOURCE',
    'hive.jdbc.update.on.duplicate' = 'true',
    'hive.jdbc.primary.key.fields' = 'server,request_path,year,month,day',
    'hive.jdbc.table.create.query' = 'CREATE TABLE REQUEST_INFO_SUMMARY_PER_DAY ( server VARCHAR(50), request_path VARCHAR(150), year SMALLINT, month SMALLINT, day SMALLINT, total_hit INT)' );
    
    insert overwrite table requestInfoStatsPerDay 
    select server, request_path, year, month, day, sum(total_hit) as total_hit
    from requestInfoStatsPerHourDataFetcher 
    group by server,request_path,year,month,day;
  6. You can add another two virtual Hive tables (by changing the configurations of the requestInfoStatsPerDay and requestInfoStatsPerHourDataFetcher tables), to summarize data based on months, using the above instructions.

...