Configuring Metering Statistics
Stratos Manager (SM) and Cloud Controller (CC), which are products used in Private PaaS, publish events to WSO2 Business Activity Monitor (BAM). Stratos Manager publishes events when a user subscribes to a cartridges or unsubscribes to a cartridge. The following screenshot displays the details that are sent to BAM with every event:
Cloud Controller publishes events when an instance is going through a state transition. The following screenshot displays the values that are sent to BAM:
Enabling publishing in SM
To enable publishing in SM, add the following configurations to the
cartridge-config.properties
file, which is in the <
SM_HOME>/repository/conf/
directory.
bam.publisher.enabled=true bam.admin.username=admin bam.admin.password=admin
Enabling publishing in CC
To enable publishing in CC, follow the steps below:
- Update the
dataPublisher enable
property to to<dataPublisher enable=”true”>
in thecloud-controller.xml
file, which is in the<CC_HOME>/repository/conf/
directory. - Edit the
carbon.xml
file, which is in the<CC_HOME>/repository/conf/
directory, as follows:- Set the IP address and BAM port.
- Uncomment
<BamServerURL>
and replace it with the following and set theIP_ADDRESS
andPORT
as the BAM IP and Thrift port.
<BamServerURL>IP_ADDRESS:PORT</BamServerURL>
Configuring metering statistics in BAM
The following configurations need to be done on WSO2 Business Activity Monitor (BAM):
- Edit the
master-datasources.xml
file, which is in the<BAM_HOME>/repository/conf/datasources/
directory, as follows:- Add
WSO2MYSQL_DATASOURCE
to connect to an external MySQL database. Replace
MYSQL_HOSTNAME
,MYSQL_PORT
,MYSQL_USERNAME
andMYSQL_PASSWORD
with relevant values.<datasource> <name>WSO2MYSQL_DATASOURCE</name> <description>The datasource used for BAM Statistics dashboard</description> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://MYSQL_HOSTNAME:MYSQL_PORT/StratosStats</url> <username>MYSQL_USERNAME</username> <password>MYSQL_PASSWORD</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>
- Add
- Copy the MySQL connector JAR into
<BAM_HOME>/repository/components/lib
directory. - Install
Private_PaaS_Statistics_Monitoring.tbox
.The Toolbox includes a Hive analytic script and a jaggery application. The Hive script is used to retrieve data from the Cassandra column family and insert it into an external MySQL database.
The Jaggery application is designed in order to display metering information for each tenant. Single tenant and multi-tenant cartridge information are displayed separately via the WSO2 Private PaaS dashboard, which can be accessed via the UI.