JMXTrans Agent Integration

About 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.

Download and Compile a Java App

  1. From the command line, navigate to the app directory. See the sample spring-petclinic app below.

    cd spring-petclinic/

  2. Compile the app:

    ./mvnw package

Create an Application Manifest

  1. 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

  2. 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.

Push the App

  1. Navigate to the app directory.

    cd spring-petclinic

  2. Push the app.

    cf push

Bind a Service Instance to the App

  1. 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

  2. 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.

  3. Create a service instance.

    cf create-service heartbeat standard heartbeat

  4. Bind the service to your app.

    cf bind-service spring-petclinic heartbeat

  5. Restage the app to start the metrics flow.

    cf restage spring-petclinic

Create a pull request or raise an issue on the source for this page in GitHub