Wso2 uses MetricsDB to monitor the useful metrics in wso2 servers. The data stored in the MetricsDB are not critical for the server functionality but the data is very important to analyze the server performance when there is an issue. We can see the metrics and get an idea how the server behaved.

Enabling Metrics

The metrics feature can be enabled from $CARBON_HOME/repository/conf/metrics.xml by making <Enabled>true</Enabled>. Also we can, use -Dmetrics.enabled=true at the server start up to enable Metrics feature without editing the metrics.xml configuration file.

View the Metrics DB in default h2

1. Uncomment the following lines in wso2 carbon.xml located in {Carbon_Home}/repository/conf. <H2DatabaseConfiguration> <property name=”web” /> <property name=”webPort”>8082</property> <property name=”webAllowOthers” /> </H2DatabaseConfiguration> 2. Restart the server 3. Access http://localhost:8082 using the browser.

4.Provide JDBC URL : jdbc:h2:repository/database/WSO2MetricsDB

User Name: wso2carbon Password : wso2carbon and connect to the database. 5.You can see five tables in the database as METRIC_COUNTER METRIC_GAUGE METRIC_HISTOGRAM METRIC_METER METRIC_TIMER There are five types of metrics as below which are store in above tables.

There are five tables(mentioned above) for each metric type. The Carbon Metrics feature store data from each metric in this database. There is a JDBC Reporter running each one minute to store data in this database. The polling period can be configured from repository/conf/metrics.xml. There is also a clean up task to remove data older than 7 days. The ultimate purpose of monitoring these statistics is to get an idea about server performance. Instead of the h2 database wso2 recommends to use a central database to store the metrics.

Move metrics DB to a centralized MySQL DB

Please use following steps to move metrics DB to a centralized MySQL DB.

Originally published at

Written by

Associate Technical Lead @ WSO2

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store