JBoss Connection Pool Monitoring Extension


An AppDynamics extension to be used with a stand alone Java machine agent to provide JBoss DataSource connection pool statistics.

Use Case

Red Hat JBoss Application Server and/or Enterprise Application Platform (EAP) are platforms to develop and deploy Java EE applications.

As of JBoss EAP 6 (and JBoss Application Server 7) the MBEAN jboss.jca.ManagedConnectionPool is no longer available and this prevents access to DataSource connection statistics via JMX.

This monitoring extension makes use of commands via jboss-cli.sh instead.


  1. Before the extension is installed, the prerequisites mentioned here need to be met. Please do not proceed with the extension installation if the specified prerequisites are not met.

  2. Starting from EAP 6.3, DataSource statistics need to be explicitly enabled before accessing as they are disabled by default to avoid any performance impact.

    Execute in jboss-cli.sh command:

  3. Alternatively set the statistics-enabled attribute to true in the standalone.xml or domain.xml respectively.

    <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="true">
  4. A restart of the JBoss server is required to take effect. To know more, please follow this link (Red Hat account required)


  1. After downloading and unzipping, use an editor to configure the user defined variables in JBossDatasourceMonitor/data-sources.sh according to the provided comments.
  2. Verify your settings by running data-sources.sh from the command prompt and with the user permissions of the Machine Agent. The output should look like:

    name=Custom Metrics|JBoss|data-source|ExampleDS|ActiveCount,aggregator=OBSERVATION,value=10
    name=Custom Metrics|JBoss|data-source|ExampleDS|AvailableCount,aggregator=OBSERVATION,value=20
  3. Copy directory JBossDatasourceMonitor into directory MACHINE_AGENT_HOME/monitors
  4. Restart the machine agent, check its logs and any non empty jboss_data-sources_$$.err file in the JBossDatasourceMonitor directory.
  5. Finally lookup the provided metrics via the AppDynamics metrics browser under:

    Application Infrastructure Performance> Root> Custom Metrics> JBoss> data-sources> DataSourceName

Metrics Provided

The following table contains a list of the JBoss EAP 6 core datasource statistics:

ActiveCountThe number of active connections. Each of the connections is either in use by an application or available in the pool
AvailableCountThe number of available connections in the pool.
AverageBlockingTimeThe average time spent blocking on obtaining an exclusive lock on the pool. The value is in milliseconds.
AverageCreationTimeThe average time spent creating a connection. The value is in milliseconds.
CreatedCountThe number of connections created.
DestroyedCountThe number of connections destroyed.
InUseCountThe number of connections currently in use.
MaxCreationTimeThe maximum time it took to create a connection. The value is in milliseconds.
MaxUsedCountThe maximum number of connections used.
MaxWaitCountThe maximum number of requests waiting for a connection at the same time.
MaxWaitTimeThe maximum time spent waiting for an exclusive lock on the pool.
TimedOutThe number of timed out connections.
TotalBlockingTimeThe total time spent waiting for an exclusive lock on the pool. The value is in milliseconds.
TotalCreationTimeThe total time spent creating connections. The value is in milliseconds.
WaitCountThe number of requests that had to wait for a connection.

Troubleshooting steps

Use the following suggestions to troubleshoot any issues.

  1. Please look at the troubleshooting document and make sure that everything is followed correctly.

  2. Check the machine agent log files for any issues. When seeing in the machine-agent.log WARN messages like below, you need to set and export JAVA_HOME in the --- User defined variables --- section of data-sources.sh (e.g. export JAVA_HOME=/opt/java/jdk1.7.0_79).
  3. [Worker-6] 06 Jun 2017 15:04:50,781  WARN MonitorTaskRunner$1 - ignoring error line:[/opt/jboss-6.3/bin/jboss-cli.sh: line 70: java: command not found]
  4. Check any non empty jboss_data-sources_$$.err file in the JBossDatasourceMonitor directory.
  5. Start jboss-cli.sh from the command line using the credentials of the machine agent and execute commands g>"connect" and "/subsystem=datasources:read-resource" similar to the following example:

    You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
    [disconnected /] connect [JBOSS_HOST:JBOSS_PORT]
    [standalone@localhost:9999 /] /subsystem=datasources:read-resource
       "outcome" => "success",
       "result" => {
           "data-source" => {"ExampleDS" => undefined},
           "jdbc-driver" => {"h2" => undefined},
           "xa-data-source" => undefined
      "response-headers" => {"process-state" => "reload-required"}
    [standalone@localhost:9999 /] exit
  6. Adjust the script to print debug information


  • In JBoss domain mode jboss-cli.sh commands require command pre-pending with /host=<hostName>/server=<serverName>/ For example:

  • By default, a Machine agent or a AppServer agent can only send a fixed number of metrics to the controller. To change this limit, please follow the instructions mentioned here. For example:

    java -Dappdynamics.agent.maxMetrics=2500 -jar machineagent.jar


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


Find out more in the AppDynamics Exchange.


Version 1.04: Initial version

Version 1.05: Optimized cpu and memory usage. Processing multiple datasources now requires a single execution of jboss-cli.sh (i.e. a single jvm) instead of one per datasource.


For any questions or feature request, please contact AppDynamics Center of Excellence.

Version: 1.0.5 Controller Compatibility: 4.1+ JBoss EAP Versions Tested On: 6 and 7