Prometheus

Table of Contents

Prometheus

Prometheusの設定

設定ファイルの検証(Dockerで動作している場合)

$ docker exec admin_prometheus_1 /bin/promtool check config  /prometheus/prometheus.yml

Alertmanagerの設定

設定ファイルの検証(Dockerで動作している場合)

$ docker exec admin_alertmanager_1 /bin/amtool check-config /alertmanager/alertmanager.yml

API

Alertの取得

$ curl  http://example.com/api/v1/alerts

Alertの作成

$ curl -d @alert.json -H "Content-Type: application/json" http://example.com/api/v1/alerts
[
  {
    "labels": {
      "alertname": "Instance Down(Critical)",
      "severity": "test",
      "job": "common"
    },
    "annotations": {
      "description": "instance xxxxxx has been down for more than 5 minutes",
      "summary": "Instance xxxxxx down"
    },
    "startsAt": "2019-02-04T09:31:24Z",
    "generatorURL": "https://example.com"
  }
]

Validate