Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add updates2 note

The API Manager Analytics provides reports, statistics and graphs on the APIs deployed in WSO2 Open Banking API Manager. You can then configure alerts to monitor these APIs and detect unusual activity, manage locations via geo-location statistics and carry out a detailed analysis of the logs. 

...

Tip
titleBefore you begin,

Download API-M Analytics 2.6.0 and unzip the file, or add API-M Analytics 2.6.0 through WUM using the following commands:

  1. Add API-M Analytics 2.6.0 WUM pack.

    Code Block
    wum add wso2am-analytics-2.6.0 
  2. Update API-M Analytics 2.6.0 product packs using WUM.

    Code Block
    wum update wso2am-analytics-2.6.0
    Warning

    WSO2 Updates Manager (WUM) is deprecated and will be unavailable from July 2021 onwards. WSO2 Updates is the new tool to include the solution and security improvements that are released by WSO2 Open Banking, on top of a released version. For more information, see WSO2 Updates.

    Expand
    titleClick here to see how to update the solution via WSO2 Update tool...

    The WSO2 Update tool delivers hotfixes and updates seamlessly on top of products as WSO2 Updates. They include improvements that are released by WSO2. You need to update the product using the relevant script.

    • Go to <WSO2_OB_APIM_HOME>/bin and run the WSO2 Update tool: 

      Localtabgroup
      Localtab
      titleOn Linux
      Code Block
      ./wso2update_linux 
      Localtab
      titleOn Mac
      Code Block
      ./wso2update_darwin
      Localtab
      titleOn Windows
      Code Block
      ./wso2update_windows.exe

Table of Contents
maxLevel3
minLevel3

...

Note

By default, the API Management Analytics profile has a port offset of 1. This  This guide is instructed for a machine server that only runs API Management Analytics with the port offsets offset set to 1.

Configuring the API Management Analytics 

Follow the instructions below to configure the API Management Analytics to publish statistics.

  1. Open the <WSO2_OB_APIM_HOME>/repository/conf/api-manager.xml file. 
  2. Configure the properties under the <Analytics> sub element.

    Code Block
    languagexml
    <Analytics>
            <!-- Enable Analytics for API Manager -->
            <Enabled>true</Enabled>
    
            <!-- Server URL of the remote StreamProcessor server used to collect statistics. Must
                be specified in protocol://hostname:port/ format.
    
                An event can also be published to multiple Receiver Groups each having 1 or more receivers. Receiver
                Groups are delimited by curly braces whereas receivers are delimited by commas.
                Ex - Multiple Receivers within a single group
                tcp://localhost:7612/,tcp://localhost:7613/,tcp://localhost:7614/
    
                Ex - Multiple Receiver Groups with two receivers each
                {tcp://localhost:7612/,tcp://localhost:7613},{tcp://localhost:7712/,tcp://localhost:7713/} -->
            <StreamProcessorServerURL>{<PROTOCOL>://<ANALYTICS_SERVER_HOSTNAME>:<PORT>}</StreamProcessorServerURL>
    </Analytics>
  3. Save the changes and restart the WSO2 Open Banking API Manager server.


Configuring databases

Info

The following is a list of database versions that are compatible with the Analytics profile.

  • MySQL 5.6
  • MySQL 5.7 
  • Oracle 12c
  • MS SQL Server 2012

...

Info

When using Oracle or MS SQL, download the database driver and include it within <WSO2_APIM_ANALYTICS_HOME>/lib directory.

  1. Create the ANALYTICS_DB database openbank_apimgt_statsdb database in your database server.

  2. Configure the worker profile.   

    Open the <WSO2_OB_API-M_ANALYTICS_HOME>/conf/worker/deployment.yaml file. Update the APIM_ANALYTICS_DB datasource with your database configurationspointing it to the openbank_apimgt_statsdb database using your database configurations.

    deployment.yaml
    Note

    If you are using Oracle, update the connectionTestQuery in each datasource with the following value.

    Code Block
    languagexml
    title
    connectionTestQuery: SELECT 1 FROM DUAL
    Code Block
    languagexml
    - name: APIM_ANALYTICS_DB
    description: The Datasource used for APIM Analytics
    jndiConfig:
      name: jdbc/APIM_ANALYTICS_DB
    definition:
      type: RDBMS
      configuration:
        jdbcUrl: 'jdbc:<DB_TYPE>://<DB_HOST>:<DB_PORT>/ANALYTICSopenbank_apimgt_DBstatsdb?autoReconnect=true&useSSL=false'
        username: <DB_USERNAME>
        password: <DB_PASSWORD>
        driverClassName: <DB_DRIVER>
        maxPoolSize: 50
        idleTimeout: 60000
        connectionTestQuery: SELECT 1
        validationTimeout: 30000
        isAutoCommit: false
  3. Configure the dashboard profile.   

    Open the <WSO2_OB_API-M_ANALYTICS_HOME>/conf/dashboard/deployment.yaml file. Update the APIM_ANALYTICS_DB datasource with your database configurations.

    deployment.yaml
    Note

    If you are using Oracle, update the connectionTestQuery in each datasource with the following value.

    Code Block
    languagexml
    title
    connectionTestQuery: SELECT 1 FROM DUAL
    Code Block
    languagexml
    - name: APIM_ANALYTICS_DB
    description: The Datasource used for APIM Analytics
    jndiConfig:
      name: jdbc/APIM_ANALYTICS_DB
    definition:
      type: RDBMS
      configuration:
        jdbcUrl: 'jdbc:<DB_TYPE>://<DB_HOST>:<DB_PORT>/ANALYTICSopenbank_apimgt_DBstatsdb?autoReconnect=true&useSSL=false'
        username: <DB_USERNAME>
        password: <DB_PASSWORD>
        driverClassName: <DB_DRIVER>
        maxPoolSize: 50
        idleTimeout: 60000
        connectionTestQuery: SELECT 1
        validationTimeout: 30000
        isAutoCommit: false
    Tip

    By default, the following datasource entries are configured to H2 databases. If required, you can create external databases and point these entries to them.

    Datasource NameFile
    BUSINESS_RULES_DB<WSO2_OB_API-M_ANALYTICS_HOME>/conf/dashboard/deployment.yaml
    WSO2_PERMISSIONS_DB<WSO2_OB_API-M_ANALYTICS_HOME>/conf/worker/deployment.yaml <WSO2_OB_API-M_ANALYTICS_HOME>/conf/dashboard/deployment.yaml
    Note

    The GEO_LOCATION_DATA datasource should be configured when you are using Geo-location based statistics

  4. Integrate third-party products when configuring databases.

    Note

    WSO2 SP Stream Processor is a an OSGi-based product. Therefore, when you integrate third party products such as Oracle and MS SQL with WSO2 API-M Analytics, you need to check whether the libraries you need to add are OSGi based. If they are not, you need to convert them to OSGi bundles before adding them to the <WSO2_OB_API-M_ANALYTICS_HOME>/lib directory. 

    To convert the jar files to OSGi bundles, follow the steps below.

    1. Download the non-OSGi jar for the required third party product, and save it in a preferred directory in your machine.

    2. Go to the <API-M_ANALYTICS_HOME>/bin directory. Run the command given below, to generate the converted file in the <API-M_ANALYTICS_HOME>/lib directory.

    Code Block
    ./jartobundle.sh <PATH_TO_NON-OSGi_JAR> ../lib

...

Note

You can enable performance tuning by adding configurations, as described in Performance Tuning in the WSO2 Stream Processor documentation.


  1. Set the path and hostname to API-M Analytics in the wso2-obam1.3.0/repository/resources/finance/script/startup.properties file.
  2. Navigate to the wso2am-analytics-2.6.0Navigate to the <WSO2_OB_API-M_ANALYTICS_HOME>/bin directory, and give execution permissions to the worker.sh file.
  3. Run the API-M Analytics worker.sh as follows:

    Code Block
    ./bin/worker.sh
  4. Navigate to the wso2am-analytics-2.6.0the <WSO2_OB_API-M_ANALYTICS_HOME>/bin directory, and give execution permissions to the dashboard.sh file.
  5. Run the API-M Analytics dashboard.sh as follows:

    Code Block
    ./bin/dashboard.sh 
  6. Open the wso2-obam-1.3.0/repository/conf/api-manager.xml file to enable analytics:

    Code Block
    <Analytics>
         <Enabled>true</Enabled>
    <Analytics>
  7. Save your changes and restart the API-M server from the wso2-obam-1.3.0/bin directory.
  8. You can view analytics data as described below:
    1. Log in to the API Store using the credentials provided during signup.
    2. Click the Analytics tab.
    3. You can view API Usage, Top Users and Faulty Invocations details through the subtopics.
  9. To observe data analysis based on geographical locations, see Configuring Geolocation Based Statistics.

...

This guide is instructed for a machine that only runs API Management Analytics with the port offsets set to 1.

...