API Manager integrates with API Manager Analytics to provide reports, statistic and graphs regarding APIs deployed in the WSO2 API Manager. WSO2 API Manager has an improved version of Analytics to address specific scenarios of the API Manager. It is possible to configure alerts to supervise these APIs and detect unusual activities, manage locations via geolocation statistics and perform a detailed record analysis. Below we explain how to configure it, step by step.
Steps to install WSO2 API Manager (APIM) Analytics
Below we explain how to configure analytics for WSO2 API Manager (WSO2 APIM). The API Manager integrates with the WSO2 Stream Processor 4.3.0 to offer reports, statistics and graphs regarding APIs deployed in the WSO2 API Manager. It is possible to configure alerts to supervise these APIs and detect unusual activities, manage locations via geolocation statistics and perform a detailed record analysis. WSO2 API Manager has an improved version of Analytics to address specific scenarios of the API Manager that are used to configure APIM Analytics.
By default, WSO2 API Manager has a port offset of 0 (no port offset) and WSO2 API Manager Analytics has an offset of 1. Therefore, this guide assumes that you do not have any other Carbon server running on the same machine with a port offset of 0 or 1.
Step 1 – Download and install WSO2 API Manager (APIM)
In order to download the WSO2 APIM, go to the WSO2 API Manager page and click on ‘DOWNLOAD or OTHER INSTALLATION OPTIONS’. For more information about the installation of WSO2 API-M, check the Installation Guide.
Step 2 – Download and install WSO2 API Manager (APIM) Analytics
In order to download WSO2 API-M Analytics you need to go to the WSO2 API Manager page and click on ‘OTHER INSTALLATION OPTIONS’. Then you can access the ‘Installation Options’ and you need to go to ‘Analytics’. The API-M Analytics installation process is identical to that of the installation of the WSO2 Stream Processor Server 4.3.0 (WSO2 SP). After making sure that you meet the installation pre-requirements, install WSO2 API-M Analytics based on the installation instructions that apply to your operating system, whether it is Linux, Windows, Windows Service or Linux Service.
Step 3 – Configure the WSO2 API Manager to publish statistics
To download the WSO2 API Manager distribution, you need to click on ‘DOWNLOAD’ and then on ‘DOWNLOAD’ Server on the WSO2 API Manager page. If you are working on a distributed (grouped) setup of API Manager, configure the Publisher, Store and Gateway nodes of the API Manager as appropriate.
- Open the <API-M_HOME>/repository/conf/api-manager.xml file.
- In the <Analytics> subelement, set the ‘Enabled’ parameter to ‘true’.
- Configure the parameters if necessary.
- Save the changes.
Step 4 – Configure the databases
Configuring the databases will allow you to store the data related with the APIs, process it and analyze it. The databases that are compatible with WSO2 API-M Analytics are Postgres 9.5 and above, MySQL 5.6, MySQL 5.7, Oracle 12c, MS SQL Server 2012 and DB2. You must follow this procedure to configure the databases:
1.Stop the WSO2 API-M Analytics server if it is running.
2.Configure the dashboard format by opening the ‘<API-M_ANALYTICS_HOME>/conf/dashboard/deployment.yaml’ file and editing the ‘APIM_ANALYTICS_DB’ section.
3.Configure the user profile:
- Open the ‘<API-M_ANALYTICS_HOME>/conf/worker/deployment.yaml’ file.
- Edit the ‘APIM_ANALYTICS_DB’ section.
- Configure ‘WSO2AM_MGW_ANALYTICS_DB’ in the same database as ‘APIM_ANALYTICS_DB’ in the ‘<API-M_ANALYTICS_HOME>/conf/worker/deployment.yaml’ file.
- Create the ‘AM_USAGE_UPLOADED_FILES’ table in the ‘APIM_ANALYTICS_DB’ database.
- Direct the data sources to the BUSINESS_RULES_DB (dashboard), WSO2_PERMISSIONS_DB (user + dashboard) and GEO_LOCATION_DATA (only if geolocation-based statistics are required) external databases. None of the following databases requires DB sequences. The tables will be created automatically.
- Third-party product integration when configuring the databases.
- Start the WSO2 API-M analytics server.
Step 5: Configure keystores
In the exchange of SSL messages between API Manager and API Manger Analytics, the client (which is to say, API Manager) must verify the certificate provided by the service (in other words, API Manager Analytics). To do this, the client stores the server’s trust certificate in the client-trusttore.jks keystore.
If you use a personalized keystore in API Manager and/or API Manager Analytics, import the public key certificate of API Manager Analytics into the client-truststore.jks file of API Manager. To export the public key from the server and import it into the client’s trust store, follow the steps outlined under ‘Adding CA-signed certificates to keystores’ in the Administration Guide.
WSO2 recommends using the APIM Analytics (powered by WSO2 Stream Processor Server 4.3.0) distribution to configure the minimum high-availability implementation with API Manager. However, if you want to configure WSO2 API Manager (APIM) Analytics as a more scalable implementation you need to configure an active/active cluster. On the other hand, it is not recommended to configure the Gateway node as an analytics server.