How do I run Dynatrace OneAgent with Mesos/Marathon?

To monitor applications running in Mesos clusters, it's recommended that you deploy Dynatrace OneAgent on all Mesos agent nodes (formally known as "Mesos slaves") by means of a Marathon app deployment. Following this, install Dynatrace OneAgent on the Mesos master nodes, as explained on this page.

Locate your Dynatrace environment credentials

The first step is to get your Dynatrace environment ID and token. This information is presented to you during Dynatrace OneAgent installation.

To get your Dynatrace environment ID and token

  1. Select Deploy Dynatrace from the navigation menu.
  2. Click Start installation and select Linux.
  3. Locate your environment ID and token, as shown below.

Install Dynatrace OneAgent

Deploy Dynatrace OneAgent on Mesos agent nodes.

If you're using DC/OS to manage your Mesos cluster, you can take advantage of the Dynatrace package in the DC/OS universe. The universe package will automatically deploy Dynatrace to all your Mesos agent nodes.

If you're not using DC/OS, you can run Dynatrace OneAgent as a Marathon app by following this example:

$ cat <<- EOF > dynatrace-oneagent.json
{
  "id": "dynatrace-oneagent",
  "cpus": 0.1,
  "mem": 256,
  "instances": REPLACE_WITH_NUMER_OF_NODES,
  "constraints": [["hostname", "UNIQUE"], ["hostname", "GROUP_BY"]],
  "container": {
    "type": "DOCKER",
    "volumes": [
      {
        "containerPath": "/mnt/root",
        "hostPath": "/",
        "mode": "RW"
      }
    ],
    "docker": {
      "image": "dynatrace/oneagent",
      "forcePullImage": true,
      "network": "HOST",
      "privileged": true,
      "parameters": [
        { "key": "pid", "value": "host" },
        { "key": "ipc", "value": "host" }
      ]
    }
  },
  "args": [
    "TENANT=REPLACE_WITH_YOUR_ENVIRONMENT_ID",
    "TENANT_TOKEN=REPLACE_WITH_YOUR_TOKEN",
    "SERVER=REPLACE_WITH_YOUR_CONNECTION_ENDPOINT"
  ]
}
EOF

Be sure to replace all REPLACE_WITH placeholders in the dynatrace-oneagent.json file with the respective credential information explained above. The connection endpoint in REPLACE_WITH_YOUR_CONNECTION_ENDPOINT is https://REPLACE_WITH_YOUR_ENVIRONMENT_ID.live.dynatrace.com. If you're using Dynatrace Managed, the connection endpoint for your Managed cluster is https://<YourManagedServerURL>/e/REPLACE_WITH_ENVIRONMENT_ID.

Now send an HTTP POST request to the Mesos master leader to deploy the Marathon app with Dynatrace OneAgent.

$ curl -X POST -H "Content-Type: application/json" http://your-mesos-master:8080/v2/apps -d@dynatrace-oneagent.json

Deploy Dynatrace OneAgent on Mesos master nodes.

Marathon doesn't allow you to deploy applications to master nodes (except for nodes that are tagged as both master and agent). This is why you must manually install Dynatrace OneAgent on all Mesos master nodes that aren't additionally configured as Mesos agents. Please use the default Linux installer for this.