Rajasi Kulkarni
Rajasi Kulkarni

Reputation: 111

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

Upvotes: 1

Views: 1702

Answers (2)

Rajasi Kulkarni
Rajasi Kulkarni

Reputation: 111

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"]

Upvotes: 2

Dharmit
Dharmit

Reputation: 5908

But only meter exposed to Prometheus is 'mesos_exporter_slave_scrape_errors_total'. What are the other meters which mesos exporter exposes to Promethues.

If the mesos-exporter is listening on port 9100, you can check http://<hostname>:9100/metrics to know what metrics are being exposed. I am referring the prom/node-exporter that I have setup on one of the systems.

but if I want to run mesos exporter as a docker container how should I specify the configuration?

I am assuming you're POST'ing this JSON file to the Marathon REST API to start Docker containers. If that is indeed the case, you can specify additional options using parameters JSON directive. More info can be found on Marathon docs under the section Privileged Mode and Arbitrary Docker Options.

Hope that helps!

Upvotes: 2

Related Questions