This documentation is for WSO2 Enterprise Integrator version 6.2.0 . View documentation for the latest release.

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

This section demonstrates how the Analytics Profile of WSO2 Enterprise Integrator (WSO2 EI) is used to analyze statistics related to ESB artifacts in a multi-tenanted environment. 

Architecture

  • In a multi tenanted environment, all the tenants share the a single event publisher that publishes data to the Analytics Profile ofWSO2 EI. 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 the Analytics Profile.
  • The user database can be shared between the Analytics Profile and the ESB Profile to avoid defining the same user IDs in both environments.
  • When you log into the Analytics Dashboard with the super tenant credentials, you can view statistics related to the super tenant.
  • When you log into the Analytics Dashboard with the credentials of a tenant other than the super tenant, you can only view statistics related to the ESB Profile artifacts defined in the environment of that tenant.

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

  1. Configure a MySQL database as the user database for the Analytics Profile by following the procedure given below. As a result, the user database is shared between the Analytics Profile and the ESB Profile. Therefore, once you define the tenant1 tenant in the ESB Profile, that tenant can also access the Analytics Profile with the same credentials used to access the ESB Profile.
    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 <EI_HOME>/lib directory.

    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. Replace the URL of the WSO2_CARBON_DB with the URL of the newly created database in the <EI_HOME>/conf/datasources/master-datasources.xml file as well as in the <EI_HOME>/wso2/analytics/conf/datasources/master-datasources.xml 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 Analytics Profile. For detailed instructions, see Starting the Analytics Profile.
  3. Start the ESB Profile. For detailed instructions, see Starting the ESB Profile.

  4. Access the Management Console of the ESB profile with the following URL, and log in by entering admin as both the user name and the password.
    https://<ESB_HOST>:<ESB_PORT>/carbon
  5. 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
  6. Deploy a proxy service to the ESB Profile for the super tenant by following the procedure provided below: 

    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.
  7. 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>


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

    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.

  10. 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>

       

  11. Access the 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/ 
  12. On 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.
  13. Log out of the Analytics Dashboard and log in again with he following credentials.
    User Nametenant1@def.com
    Password: tenant1  
  14. In the ESB Analytics dashboard, click View to open the pages displaying ESB Profile 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