Search code examples
mesosmesosphereprometheus

Configuring prometheus mesos-exporter running on mesosphere DCOS


I am trying to set up mesos exporter on my mesosphere DCOS cluster. The link I am referring to is https://github.com/prometheus/mesos_exporter. The JSON file I have used is :

    {
      "id": "/mesosexporter",
      "instances": 6,
      "cpus": 0.1,
      "mem": 25,
      "constraints": [["hostname", "UNIQUE"]],
      "acceptedResourceRoles": ["slave_public","*"],
      "container": {
            "type": "DOCKER",
            "docker": {
              "image": "prom/mesos-exporter",
              "network": "BRIDGE",
              "portMappings": [
                  {
                      "containerPort": 9105,
                      "hostPort": 9105,
                      "protocol": "tcp"
                  }
              ]
            }
          },
      "healthChecks": [{
          "protocol": "TCP",
          "gracePeriodSeconds": 600,
          "intervalSeconds": 30,
          "portIndex": 0,
          "timeoutSeconds": 10,
          "maxConsecutiveFailures": 2
      }]
    }

But only meter exposed to Prometheus is 'mesos_exporter_slave_scrape_errors_total'. What are the other meters which mesos exporter exposes to Promethues. The readme from the github of mesos-exporter says that we need to provide command line flags, but if I want to run mesos exporter as a docker container how should I specify the configuration?

EDIT - The meter 'mesos_exporter_slave_scrape_errors_total' gives non-zero value, indicating that errors occurred during the scrape.

EDIT - After adding the 'parameter' primitive my JSON file looks like:

{
  "id": "/mesosexporter",
  "instances": 1,
  "cpus": 0.1,
  "mem": 25,
  "constraints": [["hostname", "UNIQUE"]],
  "acceptedResourceRoles": ["slave_public"],
  "container": {
        "type": "DOCKER",
        "docker": {
                   "image": "prom/mesos-exporter",
                   "network": "BRIDGE",
                   "portMappings": [
                                     {
                                       "containerPort": 9105,
                                       "hostPort": 9105,
                                       "protocol": "tcp"
                                     }
                                   ],
                   "privileged": true,
                   "parameters": [
                                     { "key": "-exporter.discovery", "value": "true" },
                                     { "key": "-exporter.discovery.master-url",
                                       "value": "http://mymasterDNS.amazonaws.com:5050" }
                                 ]
                 }
  },
  "healthChecks": [{
      "protocol": "TCP",
      "gracePeriodSeconds": 600,
      "intervalSeconds": 30,
      "portIndex": 0,
      "timeoutSeconds": 10,
      "maxConsecutiveFailures": 2
  }]
}

Mesos version: 0.22.1

Marathon version: 0.8.2-SNAPSHOT

The app remains in 'deploying' state after using this JSON


Solution

  • Using the args primitive solved the problem. The equivalent docker command is docker run -p 9105:9105 prom/mesos-exporter -exporter.discovery=true -exporter.discovery.master-url="mymasternodeDNS:5050" -log.level=debug As the parameters 'exporter.discovery', 'exporter.discovery.master-url' and 'log.level' are for the image entry point and not for 'docker run', 'args' has to be used.

    The format for 'args' as added in the working JSON is:

       "args": [
          "-exporter.discovery=true",
          "-exporter.discovery.master-url=http://mymasternodeDNS:5050",
          "-log.level=debug"]