How do I monitor IBM Bluemix?

Before you begin

What you’ll need:

What is IBM Bluemix?

IBM Bluemix is a platform as a service (PaaS) that’s based on open source Cloud Foundry technology. IBM offers three deployment options for running Bluemix: public, dedicated, and local.

Applications deployed on Bluemix are usually run through technology-specific and IBM-related buildpacks that provide framework and runtime support for applications running on the platform. For example, to run Java applications on Bluemix, typically the IBM WebSphere Liberty buildpack is used rather than the normal Java buildpack.

Installation

These guidelines apply to integration with IBM WebSphere Application Server Liberty Buildpack, Java Buildpack, and Node.js apps (using the Dynatrace NPM module for PaaS).

Generate API token

The first step is to get your environment ID and generate an API token for your Dynatrace environment. All the required information is presented to you in the Deploy Dynatrace wizard.

  1. From your Dynatrace home dashboard, open the navigation menu and select Deploy Dynatrace.
  2. On the Deploy Dynatrace page, click Set up PaaS integration. Here you can copy the environment ID and generate the API token that Dynatrace needs to link your Dynatrace account with apps deployed on Bluemix, as shown below.

Get the Cloud Foundry CLI

The code examples below use the cf CLI for interfacing with the Cloud Foundry cluster (i.e, Bluemix environment). You can find the appropriate CLI for your operating system on GitHub.

Create a Dynatrace service in your Bluemix environment

Cloud Foundry (and therefore also Bluemix) allows you to connect applications with 3rd party tools and other external resources (for example, databases) by means of services. On Cloud Foundry, service instances hold the credentials that are required to connect to such resources. You’ll use this same approach to connect your apps with OneAgent.

This is why you need to define a service instance by either creating a so-called “user-provided service” or by using a service broker application.

Please select one of the following:

Option 1: Create a user-provided service

Create a single service instance for Dynatrace with the name dynatrace as a substring. For example:

  $ cf cups dynatrace-service -p '{"environmentid":"<environmentID>", "apitoken":"<token>"}'

Be sure to replace <environmentID> and <token> with your credentials, as explained above.

If you’re using Dynatrace Managed, you need to add an extra field to the payload that specifies the API endpoint of your Managed cluster: apiurl: This needs to be set to https://<YourManagedServerURL>/e/<environmentID>/api.

Option 2: Create a service instance via service broker

If you want to maintain Dynatrace credentials in a central location, use a service broker. For complete details, visit GitHub. You must configure and run the broker as an application, add the service broker to Cloud Foundry, enable service access to users, and finally, create the service instance.

Bind Dynatrace service to your application

You can either bind the created Dynatrace service to your application in your manifest.yml file prior to starting your app or you can bind the service to your app and restage the app afterwards.

If you’re pushing a Java application, the result may resemble the following example. If you’re deploying to Bluemix Public, be sure to accept IBM licenses by setting the proper environment variables. For details, please refer to the buildpack’s readme.

---
applications:
- name: demo-helloworld
  path: target/JavaHelloWorldApp.war
  buildpack: https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack.git
  memory: 512M
  instances: 1
  host: hello-world-${random-word}
  disk_quota: 1024M
services:
  - dynatrace-service
env:
  IBM_LIBERTY_LICENSE: <liberty-license-key>
  IBM_JVM_LICENSE: <jvm-license-key>

If you’re pushing a Node.js app to Bluemix, you need to first install the NPM module and load the module in your application.

Run npm install in your project directory.

  $ npm install --save @dynatrace/oneagent

As the first statement of your application, add:

try {
    require('@dynatrace/oneagent')();
} catch(err) {
    console.log(err.toString());
}

Supported integrations with Bluemix (Beta)

Dynatrace is currently integrated with:

Please note that these buildpacks are maintained by the Cloud Foundry Foundation on GitHub. If you experience issues with the integration of Dynatrace into these buildpacks or the NPM module, please get in touch with Dynatrace Support. The Cloud Foundry integrations are currently considered Beta.

Using earlier versions of buildpacks

If you’re using versions of the Java Buildpack or the IBM WebSphere Application Server Liberty Buildpack that were released before Nov 30th, 2016 you’ll need to provide deprecated tenant token credentials. Please refer to the respective section on the Cloud Foundry help page.