HomeDocumentation > Configuring and administering > Monitoring the health of the Apache Geronimo server > Monitoring components on Geronimo Server > Configuring your own Monitoring Plugin DataSource

The basic information of the server can be captured and stored in a database that is supported by Geronimo. The Geronimo management node takes advantage of MBeans to collect the server's statistics for a given time, also called snapshots. These snapshots are all JSR 77 compatible. In this way the administrator can monitor the server status.

By default, the datasources are used to connect an Apache Derby database (the reason for this is because the default DB that Geronimo uses is also Derby). However, since the datasources are all packaged into separate plugins, anyone is able to write their own datasource deployment descriptor, package it into a plugin, and use it instead of the one provided by default.

In order to use your own database for the Monitoring Plugin you must ensure the following:

  • Datasource for the Active Database must be named jdbc/ActiveDS
  • Datasource for the Archive Database must be named jdbc/ArchiveDS
  • Module ID must be org.apache.geronimo.plugins.monitoring/agent-ds//car because there is a dependency on this module ID in the plugin

The deployment descriptor for the original datasource

Here is the original deployment descriptor for the datasources used for the Monitoring Plugin in <geronimo_home>\repository\org\apache\geronimo\plugins\monitoring\agent-ds\<version>\agent-ds-<version>.car\META-INF.

plan.xml

META-INF/database/derby is the path of createTables.sql packaged in tha JAR file <geronimo_home>\repository\org\apache\geronimo\plugins\monitoring\agent-sql\<version>\agent-sql-<version>.jar, which is a dependency of the datasource.

The two gbeans at the end of the deployment descriptor is pointing to an SQL file createTables.sql in order to create the necessary tables under the condition that they do not exist. The elements of these two tables are described as the following:

  • MBeans
    • id (Primary Key): id of the MBean.
    • mbeanName: name of the MBean.
    • statsNameList: comma separated strings to represent an MBean's statistics name.
  • Statistics
    • id (Primary Key): id of the statistics.
    • mbeanId (Foreign Key): id of MBean.
    • snapshot_time: the duration of time in between snapshots.
    • statsValueList: comma separated strings to represent an MBean's statistics value.
excerpt from createTables.sql

An Example

In this example, we will replace the default Apache Derby plugin datasource in Geronimo 2.2 with a DB2 Express-C one.

Prerequisites

Before we get started to replace the monitoring plugin datasource, we should install DB2 Express-C database and its driver JAR packages on Geronimo, and then configure a DB2 Express-C datasource for Geronimo to connect to that database.

  1. Download and install DB2 Express-C. See DB2 Express-C for details about downloading and installing this database.
  2. Install the driver JAR packages on Geronimo. See Adding DB2 drivers to the repository for detailed steps.
  3. Deploy a datasource for DB2 Express-C. See Creating a database connection pool using the wizard from the Geronimo Administration Console for detailed information.

Replacing the default monitoring plugin datasouce

Now that we have a DB2 monitoring plugin datasource, we have to create deployment descriptors for the datasource.

  1. Create the deployment plan db2-agent-ds.xml based on the default plan.xml.
    db2-agent-ds.xml
    You have to make the following changes to db2-agent-ds.xml:
    • Update <dependencies> section with drivers required by DB2 Express-C.
    • Change the username and password for the datasource, and add ServerName and portnumber settings.
    • The DatabaseName for jdbc/ActiveDS is activedb, and the DatabaseName for jdbc/ArchiveDS is archdb.
  2. Similarly, create db2-mconsole-ds.xml. DatabaseName in this file is mcdb.
  3. Create the corresponding databases in DB2 Express-C: activedb, archdb and mcdb.
  4. Change var\config\config.xml for Geronimo to prevent the following modules from being launched at startup time. This can be done by adding a Load="false" to each module. This will prevent the configuration changes below from causing conflicts.
    • org.apache.geronimo.plugins.monitoring/agent-ds/2.2/car
    • org.apache.geronimo.plugins.monitoring/agent/2.2/car
    • org.apache.geronimo.plugins.monitoring/mconsole-ds/2.2/car
    • org.apache.geronimo.plugins.monitoring/mconsole-tomcat/2.2/car
  5. Start the server and deploy the plans using the deploy command.
    deploy.bat deploy ..\repository\org\tranql\tranql-connector-db2-xa\1.3\tranql-connector-db2-xa-1.3.rar <plan_path>:\db2-agent-ds.xml
    deploy.bat deploy ..\repository\org\tranql\tranql-connector-db2-xa\1.3\tranql-connector-db2-xa-1.3.rar <plan_path>:\db2-mconsole-ds.xml
    
    where <plan_path> is the directory where your plans are placed.
  6. Shutdown the server and change var\config\artifact_aliases.properties file to replace default modules. In this way Geronimo will load DB2 datasources at startup time instead of the default ones.
    org.apache.geronimo.plugins.monitoring/agent-ds/2.2/car=org.apache.geronimo.plugins.monitoring/db2-agent-ds/2.2/car 
    org.apache.geronimo.plugins.monitoring/mconsole-ds/2.2/car=org.apache.geronimo.plugins.monitoring/db2-mconsole-ds/2.2/car
    
  7. In var\config\config.xml, load org.apache.geronimo.plugins.monitoring/agent/2.2/car and org.apache.geronimo.plugins.monitoring/mconsole-tomcat/2.2/car at startup time. This can be done by removing the Load="false" for each module.