Configuring the Status Dashboard
The following sections cover the configurations that need to be done in order to view statistics relating to the performance of your WSO2 SP deployment in the status dashboard.
Assigning unique carbon IDs to nodes
Carbon metrics use the carbon ID as the source ID for metrics. Therefore, all the worker nodes are required to have a unique carbon ID defined in the wso2.carbon: section of the <SP_HOME>/conf/worker/deployment.yaml file as shown in the extract below.
You need to ensure that the carbon ID of each node is unique because it is required for the Status dashboard to identify the worker nodes and display their statistics accordingly.
wso2.carbon:
# value to uniquely identify a server
id: wso2-sp
# server name
name: WSO2 Stream Processor
# ports used by this server
Setting up the database
To monitor statistics in the Status Dashboard, you need a shared metrics database that stores the metrics of all the nodes.
Set up a database of the required type by following the steps below. In this section, a MySQL database is created as an example.
The Status Dashboard is only supported with H2, MySQL, MSSQL and Oracle database types. It is configured with the H2 database type by default. If you want to continue to use H2, skip this step.
Download and install the required database type. For this example, let's download and install MySQL Server.
Download the required database driver. For this example, download the MySQL JDBC driver.
Unzip the database driver you downloaded, copy its JAR file (
mysql-connector-java-x.x.xx-bin.jarin this example), and place it in the<SP_HOME>/libdirectory.Enter the following command in a terminal/command window, where
usernameis the username you want to use to access the databases.
mysql -u username -pWhen prompted, specify the password you are using to access the databases with the username you specified.
Create two databases named
WSO2_METRICS_DB(to store metrics data) andWSO2_STATUS_DASHBOARD_DB(to store statistics) with tables. To create MySQL databases and tables for this example, run the following commands.mysql> create database WSO2_METRICS_DB; mysql> use WSO2_METRICS_DB; mysql> source <SP_HOME>/wso2/editor/dbscripts/metrics/mysql.sql; mysql> grant all on WSO2_METRICS_DB.* TO username@localhost identified by "password";mysql> create database WSO2_STATUS_DASHBOARD_DB; mysql> use WSO2_STATUS_DASHBOARD_DB; mysql> source <SP_HOME>/wso2/editor/dbscripts/metrics/mysql.sql; mysql> grant all on WSO2_STATUS_DASHBOARD_DB.* TO username@localhost identified by "password";Create two data sources named
WSO2_METRICS_DBandWSO2_STATUS_DASHBOARD_DBby adding the following data source configurations under thewso2.datasources:section of the<SP_HOME>/conf/worker/deployment.yamlfile.WSO2_METRICS_DB- name: WSO2_METRICS_DB description: The datasource used for dashboard feature jndiConfig: name: jdbc/WSO2MetricsDB definition: type: RDBMS configuration: jdbcUrl: 'jdbc:mysql://localhost/WSO2_METRICS_DB?useSSL=false' username: root password: root driverClassName: com.mysql.jdbc.Driver maxPoolSize: 50 idleTimeout: 60000 connectionTestQuery: SELECT 1 validationTimeout: 30000 isAutoCommit: falseWSO2_STATUS_DASHBOARD_DB- name: WSO2_STATUS_DASHBOARD_DB description: The datasource used for dashboard feature jndiConfig: name: jdbc/wso2_status_dashboard useJndiReference: true definition: type: RDBMS configuration: jdbcUrl: 'jdbc:mysql://localhost/WSO2_STATUS_DASHBOARD_DB?useSSL=false' username: root password: root driverClassName: com.mysql.jdbc.Driver maxPoolSize: 50 idleTimeout: 60000 connectionTestQuery: SELECT 1 validationTimeout: 30000 isAutoCommit: falseThe following are sample configurations for database tables when you use other database types supported.
Configuring metrics
This section explains how to configure metrics for your status dashboard.
Configuring worker metrics
To enable metrics and to configure metric-related properties, do the following configurations in the < SP_HOME>/conf/worker/deployment.yaml file for the required nodes.
To enable Carbon metrics, set the
enabledproperty totrueunderwso2.metricsas shown below.wso2.metrics: enabled: trueTo enable JDBC reporting, set the
Enable JDBC parametertotruein thewso2.metrics.jdbc:=>reporting:subsection as shown below. If JDBC reporting is not enabled, only real-time metrics are displayed in the first page of the Status dashboard, and information relating to metrics history is not displayed in the other pages of the dashboard. To render the first entry of the graph, you need to wait for the time duration specified as thepollingPeriod.# Enable JDBC Reporter name: JDBC enabled: true pollingPeriod: 60Under
wso2.metrics.jdbc, configure the following properties to clean up the database entries.
wso2.metrics.jdbc: # Data Source Configurations for JDBC Reporters dataSource: # Default Data Source Configuration - &JDBC01 # JNDI name of the data source to be used by the JDBC Reporter. # This data source should be defined in a *-datasources.xml file in conf/datasources directory. dataSourceName: java:comp/env/jdbc/WSO2MetricsDB # Schedule regular deletion of metrics data older than a set number of days. # It is recommended that you enable this job to ensure your metrics tables do not get extremely large. # Deleting data older than seven days should be sufficient. scheduledCleanup: # Enable scheduled cleanup to delete Metrics data in the database. enabled: false # The scheduled job will cleanup all data older than the specified days daysToKeep: 7 # This is the period for each cleanup operation in seconds. scheduledCleanupPeriod: 86400
JVM metrics of which the log level is set to
OFFare not measured by default. If you need to monitor one or more of them, add the relevant metric name(s) under thewso2.metrics:=>levelssubsection as shown in the extract below. As shown below, you also need to mention log4j mode in which the metrics need to be monitored (i.e.,OFF,INFO,DEBUG,TRACEorALL).
wso2.metrics: # Enable Metrics enabled: true jmx: # Register MBean when initializing Metrics registerMBean: true # MBean Name name: org.wso2.carbon:type=Metrics # Metrics Levels are organized from most specific to least: # OFF (most specific, no metrics) # INFO # DEBUG # TRACE (least specific, a lot of data) # ALL (least specific, all data) levels: # The root level configured for Metrics rootLevel: INFO # Metric Levels levels: jvm.buffers: 'OFF' jvm.class-loading: INFO jvm.gc: DEBUG jvm.memory: INFO
Configuring Siddhi application metrics
To enable Siddhi application-level metrics for a Siddhi application, you need to add the @app:statistics annotation bellow the Siddhi application name in the Siddhi file as shown in the example below.
@App:name('TestMetrics')
@app:statistics(reporter = 'jdbc')
define stream TestStream (message string);The following are the metrics measured for a Siddhi application.
The default level after enabling metrics is INFO for all the metrics listed in the following table.
Metric | Components to which the metric is applied |
|---|---|
Latency |
|
Throughput |
|
Memory | Queries (per query) |
Buffered Events Count |
|
Number of events at disruptor | Streams (per stream) |
Number of events produced/received after the restart |
|