This documentation is for WSO2 Enterprise Service Bus version 5.0.0. For the latest ESB, view the latest WSO2 Enterprise Integrator documentation.

All docs This doc
||
Skip to end of metadata
Go to start of metadata

This section demonstrates how ESB Analytics is used to analyze statistics relating to ESB artifacts in a multi-tenanted ESB environment. 

Architecture

  • In a multi tenanted environment, all the tenants share the a single event publisher that publishes data to the WSO2 ESB Analytics server. This publisher uses the credentials of the super tenant for authentication purposes.
  •  A single event receiver collects all the statistics from the ESB artifacts of all tenants, and persists them in the database configured as the super tenant's record store for ESB Analytics.
  • The user database can be shared between the ESB Analytics and the ESB server to avoid defining the same user IDs in both environments.
  • When you log into the WSO2 ESB Analytics Dashboard with the super tenant credentials, you can view statistics relating to the super tenant.
  • When you log into the WSO2 ESB Analytics Dashboard with the credentials of a tenant other than the super tenant, you can only view statistics relating to the ESB artifacts defined in the environment of that tenant.

Before you follow the steps given below, enable analytics for WSO2 ESB following the instructions given in Prerequisites to Publish Statistics.

  1. Configure a MySQL database as the user database for WSO2 ESB WSO2 ESB Analytics following the procedure given below. As a result, the user database is shared between WSO2 ESB Analytics and WSO2 ESB. Therefore, once you define the tenant1 tenant in WSO2 ESB, that tenant can also access WSO2 ESB Analytics with the same credentials used to access WSO2 ESB.
    1. Download and install MySQL Server.

    2. Download the MySQL JDBC driver.

    3. Unzip the downloaded MySQL driver zipped archive, and copy the MySQL JDBC driver JAR (mysql-connector-java-x.x.xx-bin.jar) into the <PRODUCT_HOME>/repository/components/lib directory of both WSO2 ESB Analytics and WSO2 ESB.

    4. Define the host name for configuring permissions for the new database by opening the /etc/hosts file and adding the following line:
      <MYSQL-DB-SERVER-IP> carbondb.mysql-wso2.com

      This step is required only if your database is not on your local machine and on a separate server.

    5. Enter the following command in a terminal/command window, where username is the username you want to use to access the databases:
      mysql -u username -p 
    6. When prompted, specify the password that should be used to access the databases with the username you specified.
    7. Create the databases using the following commands, where <PRODUCT_HOME> is the path to any of the product instances you installed, and username and password are the same as those you specified in the previous steps.

      About using MySQL in different operating systems

      For users of Microsoft Windows, when creating the database in MySQL, it is important to specify the character set as latin1. Failure to do this may result in an error (error code: 1709) when starting your cluster. This error occurs in certain versions of MySQL (5.6.x) and is related to the UTF-8 encoding. MySQL originally used the latin1 character set by default, which stored characters in a 2-byte sequence. However, in recent versions, MySQL defaults to UTF-8 to be friendlier to international users. Hence, you must use latin1 as the character set as indicated below in the database creation commands to avoid this problem. Note that this may result in issues with non-latin characters (like Hebrew, Japanese, etc.). The database creation command should look as follows.

      mysql> create database <DATABASE_NAME> character set latin1;


      For users of other operating systems, the standard database creation commands can be used. For these operating systems, your database creation command should look as follows.

      mysql> create database <DATABASE_NAME>;

      mysql> create database WSO2_CARBON_DB;
      mysql> use WSO2_CARBON_DB;
      mysql> source <PRODUCT_HOME>/dbscripts/mysql.sql;
      mysql> grant all on WSO2_CARBON_DB.* TO wso2carbon@"carbondb.mysql-wso2.com" identified by "wso2carbon";
    8. Add the URL of the WSO2_CARBON_DB with the URL of the newly created database in the <PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml file of both WSO2 ESB and WSO2 ESB Analytics as shown in the extract below.

      <datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
          <providers>
              <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
          </providers>
          <datasources>
              <datasource>
                  <name>WSO2_CARBON_DB</name>
                  <description>The datasource used for registry and user manager</description>
                  <jndiConfig>
                      <name>jdbc/WSO2CarbonDB</name>
                  </jndiConfig>
                  <definition type="RDBMS">
                      <configuration>
                          <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_CARBON_DB?autoReconnect=true</url>
                          <username>wso2carbon</username>
                          <password>wso2carbon</password>
                          <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                          <maxActive>50</maxActive>
                          <maxWait>60000</maxWait>
                          <testOnBorrow>true</testOnBorrow>
                          <validationQuery>SELECT 1</validationQuery>
                          <validationInterval>30000</validationInterval>
                      </configuration>
                  </definition>
              </datasource>
          </datasources>
      </datasources-configuration>
  2. Start the WSO2 ESB Analytics server, and then start the WSO2 ESB server. The following command can be issued from the <PRODUCT_HOME>/bin directory to start each server.
    1. On Windows:  wso2server.bat --run
    2. On Linux/Mac OS:  sh wso2server.sh

  3. Access the WSO2 ESB Management Console with the following URL, and log in by entering admin as both the user name and the password.
    https://<ESB_HOST>:<ESB_PORT>/carbon
  4. In the Configure tab, click Add New Tenant to open the Register a New Organization page. Then enter information as follows and save.

    ParameterValue
    Domaindef.com
    Select Usage Plan for TenantDemo
    First NameDEF
    Last NameNetworks
    Admin Usernametenant1
    New Admin Passwordtenant1
    Emaildeftenant1@gmail.com
  5. Deploy a proxy service to WSO2 ESB for the super tenant following the procedure. 

    1. Download and save this file in a preferred location in your machine.
    2. Click on the Main tab. Under Carbon Applications, click Add to open the Add Carbon Applications page. Click Choose File and browse for the file you downloaded and saved in the previous sub step. Then click Upload.
  6. Click on the Main tab. Under Services, click List. A proxy service named SimpleProxy is listed as follows.

    1. Click on this proxy service, and then click on Enable Tracing to enable both statistics and tracing. 
       
    2. Click Try this service to open the Try it Tool, and send the following request 5 times.

      <body>
         <p:echoInt xmlns:p="http://echo.services.core.carbon.wso2.org">
            <!--0 to 1 occurrence-->
            <in>1234</in>
         </p:echoInt>
      </body>


  7. Log out of the ESB Management Console, and log in again with the following credentials.
    User Name: tenant1@def.com
    Passwordtenant1 
  8. Deploy a proxy service to WSO2 ESB for the tenant1 tenant following the procedure. 

    1. Download and save this file in a preferred location in your machine.
    2. Click on the Main tab. Under Carbon Applications, click Add to open the Add Carbon Applications page. Click Choose File and browse for the file you downloaded and saved in the previous sub step. Then click Upload.

  9. Click on the Main tab. Under Services, click List. A proxy service named EchoService is listed as follows.

    1. Click on this proxy service, and then click on  Enable Tracing  to enable both statistics and tracing.
       
    2. Click Try this service to open the Try it Tool, and send the following request 5 times.

      <body>
         <p:echoInt xmlns:p="http://echo.services.core.carbon.wso2.org">
            <!--0 to 1 occurrence-->
            <in>1234</in>
         </p:echoInt>
      </body>

       

  10. Access the WSO2 ESB Analytics Dashboard with the following URL, and log in entering admin as both the username and the password.
    https://<ANALYTICS_HOST>:<ANALYTICS_PORT>/portal/dashboards/esb-analytics/ 
  11. In the ESB Analytics dashboard, click View to open the pages displaying ESB statistics.
     The following can be observed.
    1. The request summary displays a request count of 5 as shown below. This represents the 5 requests you sent from the SimpleProxy proxy service.
       
    2. The SimpleProxy service is displayed in the TOP PROXY SERVICES BY REQUEST COUNT gadget.
  12. Log out of the ESB Analytics Dashboard and log in again with he following credentials.
    User Nametenant1@def.com
    Password: tenant1  
  13. In the ESB Analytics dashboard, click View to open the pages displaying ESB statistics.
    The following can be observed. 
    1. The request summary displays a request count of 5 as shown below. This represents the 5 requests you sent from the EchoServce proxy service.
    2. The EchoService proxy service is displayed in the TOP PROXY SERVICES BY REQUEST COUNT gadget.
  • No labels