This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Configuring your own Monitoring Plugin DataSource
Skip to end of metadata
Go to start of metadata

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/agent-ds//car because there is a dependency on this module ID in the plugin

Here is the original deployment descriptor for the datasources used for the Monitoring Plugin.

plan.xml
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-${geronimoSchemaVersion}">
    <environment>
        <moduleId>
            <groupId>${pom.groupId}</groupId>
            <artifactId>${pom.artifactId}</artifactId>
            <version>${version}</version>
            <type>car</type>
        </moduleId>
        <dependencies>
            <dependency>
                <groupId>org.apache.geronimo.configs</groupId>
                <artifactId>system-database</artifactId>
                <type>car</type>
            </dependency>
            <!-- SQL files -->
            <dependency>
                <groupId>org.apache.geronimo.plugins.monitoring</groupId>
                <artifactId>agent-sql</artifactId>
                <version>${monitoringConsoleVersion}</version>
                <type>jar</type>
            </dependency>
        </dependencies>
    </environment>

    <resourceadapter>
        <outbound-resourceadapter>
            <!-- Pool for Active Statistics -->
            <connection-definition>
                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>jdbc/ActiveDS</name>
                    <config-property-setting name="CreateDatabase">true</config-property-setting>
                    <config-property-setting name="Password">monitor</config-property-setting>
                    <config-property-setting name="UserName">monitor</config-property-setting>
                    <config-property-setting name="DatabaseName">ActiveMRCDB</config-property-setting>
                    <connectionmanager>
                        <local-transaction/>
                        <single-pool>
                            <max-size>10</max-size>
                            <min-size>0</min-size>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
             </connection-definition>
             <!-- Pool for Archived Statistics -->
             <connection-definition>
                 <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                 <connectiondefinition-instance>
                     <name>jdbc/ArchiveDS</name>
                     <config-property-setting name="CreateDatabase">true</config-property-setting>
                     <config-property-setting name="Password">monitor</config-property-setting>
                     <config-property-setting name="UserName">monitor</config-property-setting>
                     <config-property-setting name="DatabaseName">ArchiveMRCDB</config-property-setting>
                     <connectionmanager>
                         <local-transaction/>
                         <single-pool>
                             <max-size>10</max-size>
                             <min-size>0</min-size>
                             <match-one/>
                         </single-pool>
                     </connectionmanager>
                 </connectiondefinition-instance>
             </connection-definition>
         </outbound-resourceadapter>
     </resourceadapter>

     <!-- These two GBeans will create the tables for the database automatically -->
     <gbean name="ActiveDSGBean" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
         <attribute name="testSQL">SELECT t.tablename FROM SYS.SYSTABLES t WHERE lower(t.tablename)='statistics'</attribute>
         <attribute name="path">META-INF/database/derby/createTables.sql</attribute>
         <reference name="DataSource">
             <name>jdbc/ActiveDS</name>
         </reference>
     </gbean>
     <gbean name="ArchiveDSGBean" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
         <attribute name="testSQL">SELECT t.tablename FROM SYS.SYSTABLES t WHERE lower(t.tablename)='statistics'</attribute>
         <attribute name="path">META-INF/database/derby/createTables.sql</attribute>
         <reference name="DataSource">
             <name>jdbc/ArchiveDS</name>
         </reference>
     </gbean>
</connector>

The two gbeans at the end of the deployment descriptor is pointing to an SQL file in order to create the necessary tables under the condition that they do no exist.

  • No labels