The API Manager Analytics provides reports, statistics and graphs on the APIs that are deployed in WSO2 Open Banking API Manager. You can 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 | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||
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:
|
Table of Contents | ||||
---|---|---|---|---|
|
...
Follow the instructions below to configure the WSO2 Open Banking API Manager to publish statistics.
- Open OApen the
<WSO2_OB_APIM_HOME>/repository/conf/api-manager.xml
file. Configure the properties under the
<Analytics>
sub element.<Enabled>
Set this property to
true
, to enable analytics for API Manager.<StreamProcessorServerURL>
The WSO2 OB APIM Analytics server URL. For example:
{tcp://<WSO2_OB_APIM_ANALYTICS_HOST>:7612}.
<StreamProcessorUsername>
Administrator username to login to the remote analytics server. Set this value to
admin.
<StreamProcessorPassword>
Administrator password to login to the remote StreamProcessor server. Set this value to
admin
.<StreamProcessorRestApiURL>
REST API URL for analytics. For example:
https://<WSO2_OB_APIM_ANALYTICS_HOST>:7444.
<StreamProcessorRestApiUsername>
Administrator username to access the analytics REST API. Set this value to
admin
.<StreamProcessorRestApiPassword>
Administrator password to access the the analytics REST API. Set this value to
admin
.Code Block language xml <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>{tcp://<WSO2_OB_APIM_ANALYTICS_HOST>:7612}</StreamProcessorServerURL> <!--StreamProcessorAuthServerURL>{ssl://localhost:7712}</StreamProcessorAuthServerURL--> <!-- Administrator username to login to the remote StreamProcessor server. --> <StreamProcessorUsername>admin</StreamProcessorUsername> <!-- Administrator password to login to the remote StreamProcessor server. --> <StreamProcessorPassword>admin</StreamProcessorPassword> <!-- For APIM implemented Statistic client for RDBMS --> <StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatsProviderImpl> <!-- StreamProcessor REST API configuration --> <StreamProcessorRestApiURL>https://<WSO2_OB_APIM_ANALYTICS_HOST>:7444</StreamProcessorRestApiURL> <StreamProcessorRestApiUsername>admin</StreamProcessorRestApiUsername> <StreamProcessorRestApiPassword>admin</StreamProcessorRestApiPassword> </Analytics>
Save the changes and restart the WSO2 Open Banking API Manager server.
...
Create the
openbank_apimgt_statsdb
database in your database server.Configure the
worker
profile.Open the
<WSO2_AMAPIM_ANALYTICS_HOME>/conf/worker/deployment.yaml
file. Update theAPIM_ANALYTICS_DB
datasource pointing it to theopenbank_apimgt_statsdb
database using your database configurations.Note If you are using Oracle, update the
connectionTestQuery
in each datasource with the following value.Code Block connectionTestQuery: SELECT 1 FROM DUAL
Code Block language xml - name: APIM_ANALYTICS_DB description: The Datasource used for APIM Analytics jndiConfig: name: jdbc/APIM_ANALYTICS_DB definition: type: RDBMS configuration: jdbcUrl: 'jdbc:mysql://localhost:3306/openbank_apimgt_statsdb?autoReconnect=true&useSSL=false' username: root password: root driverClassName: com.mysql.jdbc.Driver maxPoolSize: 50 idleTimeout: 60000 connectionTestQuery: SELECT 1 validationTimeout: 30000 isAutoCommit: false
By default, the following datasource entries are configured to H2 databases. If required, you can create external databases and point these entries to them.
<WSO2Datasource Name File BUSINESS_RULES_DB
AM<WSO2_
HOME>APIM_ANALYTICS_
<WSO2HOME>/conf/dashboard/deployment.yaml
WSO2_PERMISSIONS_DB
AM<WSO2_
HOME>APIM_ANALYTICS_
<WSO2HOME>/conf/worker/deployment.yaml
AM<WSO2_
HOME>APIM_ANALYTICS_
HOME>/conf/dashboard/deployment.yaml
Tip The
GEO_LOCATION_DATA
datasource should be configured only when you are using Geo-location based statisticsPlace the database driver in the
<WSO2_APIM_ANALYTICS_HOME>/lib
directory.Note You need to follow the steps below when you are using Oracle or MS SQL database servers.
You need to include the database driver corresponding to the database for the API Manager Analytics server to communicate with the database. The WSO2 API Manager Analytics is 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<WSO2_AMAPIM_ANALYTICS_HOME>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
<WSO2<WSO2_AMAPIM_ANALYTICS_HOMEE>HOMEE>/bin
directory. Run the command given below, to generate the converted file in the<WSO2<WSO2_AMAPIM_ANALYTICS_HOME >/lib
directory.Code Block ./jartobundle.sh <PATH_TO_NON-OSGi_JAR> ../lib
...
- You can enable performance tuning by adding configurations, as described in Performance Tuning in the WSO2 Stream Processor documentation.
- Navigate to the
<WSO2_AMAPIM_ANALYTICS_HOME>/bin
directory, and give execution permissions to theworker.sh
file. Run the API-M Analytics
worker.sh
as follows:Code Block language bash ./worker.sh
- Navigate to the
<WSO2_AMAPIM_ANALYTICS_HOME>/bin
directory, and give execution permissions to thedashboard.sh
file. Run the API-M Analytics
dashboard.sh
as follows:Code Block language bash ./dashboard.sh
- You can view analytics data as described below:
- Log in to the /wiki/spaces/OB130/pages/49053830 or /wiki/spaces/OB130/pages/49053816.
- Click the Analytics tab.
- You can view API Usage, Top Users and Faulty Invocations details through the subtopics.
- To observe data analysis based on geographical locations, see Configuring Geolocation Based Statistics.