cloud_foundry java monitoring Monitoring and Observability products

Monitoring Java Apps with AppDynamics


featured-java-monitorThe following is a guest blog post by Dustin Whittle, Developer Evangelist at AppDynamics.

AppDynamics is an Application Performance Management company that offers solutions to monitor a variety of applications running on public clouds or in private data centers. App Dynamics is excited to support Pivotal’s Cloud Platform by making it easy to monitor Java apps running on Cloud Foundry and Pivotal’s Web Services.

Monitor Apps on Pivotal Web Services

The AppDynamic Java agents are included in the default Java buildpack for Cloud Foundry, so if you have AppDynamics monitoring running, the Cloud Foundry DEA will auto-detect the service and enable the agent in the buildpack. If you start the AppDynamics monitoring for an app already running, just restart the app and the DEA will autodetect the new service.

1) Sign-up for a Pivotal Web Services account and AppDynamics Pro SaaS account

Screen Shot 2014-02-03 at 5.25.54 PM

In the future, Pivotal Web Services will include the AppDynamics SaaS APM services, so you’ll only need to signup for Pivotal Web Services and it will automatically create an AppDynamics account. But for now, don’t forget to signup signup for AppDynamics because you need both accounts!

2) Download the Cloud Foundry CLI (Command Line Interface)

Pivotal Web Services has both a web based GUI as well as a full featured linux style command line interface (CLI). Once you have a PWS account, you can download a Mac, Windows or Unix CLI from the “Toosl” tab in the PWS dashboard or directly for OSX, Linux, and Windows.

Pivotal Web Services CLI

3) Sign-in With Your Pivotal Web Services Credentials

Using the CLI, log into your Pivotal Web Services account. Remember to preface all commands given to Cloud Foundry with cf. Individual Cloud Foundry PaaS clouds are identified by their domain API endpoint. For PWS, the endpoint is api.run.pivotal.io. Cloud Foundry will automatically target your default org (you can change this later) and ask you to select a space (a space is similar to a project or folder where you can keep a collection of apps).

$ cf login

Cloud Foundry CLIÂ

Monitoring Apps on Pivotal Web Services

1) Clone the Spring Trader demo application

The sample Spring Trader app is provided by Pivotal as a demonstration. This can be used to show how monitoring works. First git clone the app from the Github repository.

$ git clone https://github.com/cloudfoundry-samples/rabbitmq-cloudfoundry-samples

2) Create a user provided service to auto-discover the AppDynamics agent

$ cf create-user-provided-service demo-app-dynamics-agent -p "host-name,port,ssl-enabled,account-name,account-access-key"

Cloud Foundry CLI

Tip: Find out more about deploying on PWS in the Java build pack docs.

3) Use the Pivotal Web Services add-on marketplace to add a cloud based AMQP + PostgreSQL database instance

$ cf create-service elephantsql turtle demo-db

$ cf create-service cloudamqp lemur demo-amqp

Cloud Foundry CLI

4) Bind PostgreSQL, AMQP, and AppDynamics services to the app

$ git clone https://github.com/cloudfoundry-samples/rabbitmq-cloudfoundry-samples

$ cd rabbitmq-cloudfoundry-samples/spring

$ mvn package

$ cf bind-service demo-app demo-app-dynamics-agent

$ cf bind-service demo-app demo-amqp

$ cf bind-service demo-app demo-db

Cloud Foundry CLI

5) Push the app to production with the CLI Upload your app with the cf push command, or (as in the example below) you can specify additional parameters including memory, number of app instances, name and the exact app path.

$ cf push demo-app -i 1 -m 512M -n demo-app -p target/rabbitmq-spring-1.0-SNAPSHOT.war

Cloud Foundry CLI

Spring AMQP Stocks Demo App

Spring Trader

Pivotal Web Services Console

Pivotal PaaS CloudFoundry

Production Monitoring with AppDynamics Pro

To get more out of your app monitoring, signup for an AppDynamic Pro account with enhanced features and code level visibility into application performance problems.

AppD Dashboard

AppD

Watch the Full Installation Video

If you missed any part of the instructions, you can watch Dustin walk through each step in this screen cast video, or reach him on Twitter @Dustin Whittle.