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 OneAgent installer URL

The first step is to obtain the location for ONEAGENT_INSTALLER_SCRIPT_URL. This information is presented to you during Dynatrace OneAgent installation.

To get your ONEAGENT_INSTALLER_SCRIPT_URL

  1. Select Deploy Dynatrace from the navigation menu.
  2. Click Start installation and select Linux.
  3. Locate your ONEAGENT_INSTALLER_SCRIPT_URL, 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" },
        { "key": "env", "value": "ONEAGENT_INSTALLER_SCRIPT_URL=REPLACE_WITH_YOUR_URL" },
        { "key": "env", "value": "ONEAGENT_INSTALLER_SKIP_CERT_CHECK=false "}
      ]
    }
  },
  "args": [
    "APP_LOG_CONTENT_ACCESS=1"
  ]
}
EOF

Be sure to replace REPLACE_WITH_YOUR_URL placeholder in the dynatrace-oneagent.json file with the Dynatrace OneAgent installer URL as explained above.

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.