C3P0 Monitoring Extension

 

This extension works only with the standalone machine agent.

 

Use Case

c3p0 is a connection pooling library for making traditional JDBC drivers "enterprise-ready" by augmenting them with functionality defined by the jdbc3 spec and the optional extensions to jdbc2. c3p0 registers MBeans under com.mchange.v2.c3p0, one with statistics about the library as a whole (called C3P0Registry), and an MBean for each PooledDataSource you deploy. Please refer here for details.

This eXtension inspects and collects c3p0 datasource statistics exposed through MBeans and reports them to AppDynamics Controller.

 

Prerequisites

Please enable JMX in the container if not already enabled that hosts the application using c3p0 connection pooling mechanism.

 

Installation

  1. Download the file C3P0Monitor.zip into <MACHINE_AGENT_HOME>/monitors/
  2. Unzip the downloaded file
  3. Configure the extension by referring to the below section.
  4. Restart the Machine Agent.

In the AppDynamics Metric Browser, look for: Application Infrastructure Performance | <Tier> | Custom Metrics | C3P0 in case of default metric path

 

Configuration

Note : Please make sure not to use tab (\t) while editing yaml files. You can validate the yaml file using a yaml validator

  1. Configure the C3P0 Extension by editing the config.yml file in <MACHINE_AGENT_HOME>/monitors/C3P0Monitor/.
  2. Specify the container instance host, JMX port, username and password in the config.yml. Configure the MBeans for this extension to report the metrics to Controller. By default, com.mchange.v2.c3p0 is the domain name. Extension by default reports the metrics of MBean C3P0Registry, one with statistics about the c3p0 library. Specify the dataSourceName you want to exclude from monitoring as a comma separated values in the keyproperty 'excludePooledDataSources'. PooledDataSource MBean ObjectName is of the form 'com.mchange.v2.c3p0:type=PooledDataSource[z8kfsx944ur8uu1osma2k|1b1a3c12]'. Please refer here for details. You can also add excludePatterns (regex) to exclude any metric tree from showing up in the AppDynamics controller.

    For eg.

        # Server hosting the C3P0 application specifics
        server:
            host: "localhost"
            port: 9044
            username: ""
            password: ""
    
        # C3P0 MBeans. Exclude patterns with regex can be used to exclude any unwanted metrics.
        mbeans:
            domainName: "com.mchange.v2.c3p0"
            excludePooledDataSources: [z8kfsx944ur8uu1osma2k|1b1a3c12]
            excludePatterns: [.*AllIdentityTokenized$, .*AllPooledDataSources$]
    
        #prefix used to show up metrics in AppDynamics
        metricPrefix:  "Custom Metrics|C3P0|"
    
    
  3. Configure the path to the config.yml file by editing the in the monitor.xml file in the <MACHINE_AGENT_HOME>/monitors/C3P0Monitor/ directory. Below is the sample

     <task-arguments>
         <!-- config file-->
         <argument name="config-file" is-required="true" default-value="monitors/C3P0Monitor/config.yml" />
          ....
     </task-arguments>
    

 

Metrics

  • C3P0Registry: AllIdentityTokenCount, AllIdentityTokenizedCount, AllPooledDataSourcesCount, NumPooledDataSources, NumPoolsAllDataSources
  • PooledDataSource: acquireIncrement, acquireRetryAttempts, acquireRetryDelay, checkoutTimeout, effectivePropertyCycleDefaultUser, idleConnectionTestPeriod, initialPoolSize, loginTimeout, maxAdministrativeTaskTime, maxConnectionAge, maxIdleTime, maxIdleTimeExcessConnections, maxPoolSize, maxStatements, maxStatementsPerConnection, minPoolSize, numBusyConnections, numBusyConnectionsAllUsers, numBusyConnectionsDefaultUser, numConnections, numConnectionsAllUsers, numConnectionsDefaultUser, numFailedCheckinsDefaultUser, numFailedCheckoutsDefaultUser, numFailedIdleTestsDefaultUser, numHelperThreads, numIdleConnections, numIdleConnectionsAllUsers, numIdleConnectionsDefaultUser, numThreadsAwaitingCheckoutDefaultUser, numUnclosedOrphanedConnections, numUnclosedOrphanedConnectionsAllUsers, numUnclosedOrphanedConnectionsDefaultUser, numUserPools, propertyCycle, startTimeMillisDefaultUser, statementCacheNumCheckedOutDefaultUser, statementCacheNumCheckedOutStatementsAllUsers, statementCacheNumConnectionsWithCachedStatementsAllUsers, statementCacheNumConnectionsWithCachedStatementsDefaultUser, statementCacheNumStatementsAllUsers, statementCacheNumStatementsDefaultUser, threadPoolNumActiveThreads, threadPoolNumIdleThreads, threadPoolNumTasksPending, threadPoolSize, unreturnedConnectionTimeout, upTimeMillisDefaultUser

 

Contributing

Always feel free to fork and contribute any changes directly via GitHub.

 

Support

 For any support questions, please contact help@appdynamics.com.

 

 

Version:

1.0.0

Compatibility:

3.7

Last Update:

8/27/2014