JMXTrans Agent Integration
This topic describes how to configure the Heartbeat service to collect JMX metrics from Java apps.
A custom Java buildpack is required to integrate the JMXTrans agent into a Java app for JMX monitoring. JMXTrans agent integration enables the app to send performance metrics to the StatsD server. These metrics are subsequently pushed to Graphite’s Carbon component for caching and persistence.
From the command line, navigate to the app directory. See the sample spring-petclinic app below.
Compile the app:
Create an application manifest based on this example:
applications: - name: spring-petclinic memory: 1G random-route: true path: target/spring-petclinic-1.5.1.jar buildpack: https://github.com/Altoros/java-buildpack#jmx-agent-integration
Add the manifest to your project:
cd spring-petclinic vim manifest.yml
Note: Altoros modified the buildpack to attach and configure the JMXTrans agent. Use only the provided Altoros/java-buildpack link to access the current version of the buildpack.
Navigate to the app directory.
Push the app.
Navigate to cf marketplace.
cf marketplace Getting services from marketplace in org admin / space demo as admin... OK service plans description app-autoscaler standard Scales bound applications in response to load (beta) heartbeat standard Heartbeat Monitoring Solution
Find Heartbeat in the list of the available services and select the service plan. Currently, only the standard service plan is available, so it will be selected by default.
Create a service instance.
cf create-service heartbeat standard heartbeat
Bind the service to your app.
cf bind-service spring-petclinic heartbeat
Restage the app to start the metrics flow.
cf restage spring-petclinic