在 mesosphere DCOS 上配置 prometheus mesos-exporter 运行

Configuring prometheus mesos-exporter running on mesosphere DCOS

我正在尝试在我的 mesosphere DCOS 集群上设置 mesos exporter。我指的link是https://github.com/prometheus/mesos_exporter。我使用的 JSON 文件是:

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

但唯一暴露给普罗米修斯的仪表是'mesos_exporter_slave_scrape_errors_total'。 mesos exporter 暴露给 Promethues 的其他仪表是什么? mesos-exporter github 的自述文件说我们需要提供命令行标志,但是如果我想 运行 mesos exporter 作为 docker 容器,我应该如何指定配置?

编辑 - 仪表 'mesos_exporter_slave_scrape_errors_total' 给出非零值,表明在抓取过程中发生了错误。

编辑 - 添加 'parameter' 原语后,我的 JSON 文件如下所示:

{
  "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 版本:0.22.1

马拉松版本:0.8.2-SNAPSHOT

应用程序在使用此 JSON

后保持 'deploying' 状态

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

如果 mesos-exporter 正在侦听端口 9100,您可以检查 http://<hostname>:9100/metrics 以了解公开了哪些指标。我指的是我在其中一个系统上设置的 prom/node-exporter

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

我假设您正在 POST 将此 JSON 文件发送到 Marathon REST API 以启动 Docker 容器。如果确实如此,您可以使用 parameters JSON 指令指定其他选项。更多信息可以在 Marathon docs 特权模式和任意 Docker 选项.

部分下找到

希望对您有所帮助!

使用 args 原语解决了问题。等效的 docker 命令是 docker 运行 -p 9105:9105 prom/mesos-exporter -exporter.discovery=true -exporter.discovery .master-url="mymasternodeDNS:5050" -log.level=调试 由于参数 'exporter.discovery'、'exporter.discovery.master-url' 和 'log.level' 用于图像入口点而不是用于 'docker run',因此必须使用 'args'。

在工作 JSON 中添加的 'args' 的格式是:

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