Monitoring of Connection Pool metrics for applications running on Cloud Foundry

Document ID : KB000122802
Last Modified Date : 10/12/2018
Show Technical Document Details
Issue:
We have a java application running on Cloud Foundry instrumented with the default APM agent that’s included in the default Java build pack.   It would be very helpful for us to see some kind of JDBC connection pool metrics, like pool size, active connections, free connections or metrics like that.   For Tomcat and Liberty in non Cloud Foundry environments we get these via JMX, are there any options to get metrics like that for Applications running on Cloud Foundry?
Resolution:
Agent properties can be passed in as java options (JAVA_OPTS) in the cloud foundry manifest.yml file. For example to enable JMX for Tomcat (which is not enabled by default) add the following JAVA_OPTS definition

---
applications:
- name: sample-app
  memory: 1G
  random-route: true
  path: build/libs/sample-app.jar
  env:
      JAVA_OPTS : "-Dintroscope.agent.jmx.enable=true -Dintroscope.agent.jmx.name.filter=*"

The manifest.yml is discussed in the documentation for running the Java agent in Cloud Foundry

https://docops.ca.com/ca-apm/10-7/en/implementing-agents/java-agent/install-the-java-agent/deploy-and-monitor-a-java-application-on-cloud-foundry#DeployandMonitoraJavaApplicationonCloudFoundry-CreatetheIntroscopeService(CAApplicationPerformanceManagement)