Info
Content

Notification Template

Prometheus генерирует алерт и шлет его в Alertmanager, a alertmanager шлет его в какой-то ресивер (на основе лейблов)
Ресивер это одна и более интеграция (слак, вебхук и тд)

Нотификации отсылаемые в ресиверы формируются через шаблоны

https://prometheus.io/docs/alerting/latest/notifications/

Пример того как нотификация из prometheus в alertmanager выглядит в wireshark:
Screenshot_2021_02_02-12_49_03-2021-07-02-at-hhhhhhhh.png

JSON из двух запросов со скрина:

[
  {
    "annotations": {
      "description": "CPU load is > 80%\n  VALUE = 100\n  LABELS = map[instance:localhost:9100]",
      "summary": "Host high CPU load (instance localhost:9100)"
    },
    "endsAt": "2021-07-02T15:23:30.321Z",
    "startsAt": "2021-07-02T15:22:45.321Z",
    "generatorURL": "http://interview:9090/graph?g0.expr=node_load1+%3E+1&g0.tab=1",
    "labels": {
      "alertname": "HostHighCpuLoad",
      "instance": "localhost:9100",
      "severity": "warning"
    }
  },
  {
    "annotations": {
      "description": "CPU load is > 80%\n  VALUE = 1.18\n  LABELS = map[__name__:node_load1 instance:localhost:9100 job:prometheus]",
      "summary": "Host high CPU load (instance localhost:9100)"
    },
    "endsAt": "2021-07-02T15:36:15.321Z",
    "startsAt": "2021-07-02T15:32:15.321Z",
    "generatorURL": "http://interview:9090/graph?g0.expr=node_load1+%3E+1&g0.tab=1",
    "labels": {
      "alertname": "HostHighCpuLoad",
      "instance": "localhost:9100",
      "job": "prometheus",
      "severity": "warning"
    }
  }
]

[
  {
    "annotations": {
      "description": "CPU load is > 80%\n  VALUE = 1.16\n  LABELS = map[__name__:node_load1 instance:localhost:9100 job:prometheus]",
      "summary": "Host high CPU load (instance localhost:9100)"
    },
    "endsAt": "2021-07-02T15:33:00.321Z",
    "startsAt": "2021-07-02T15:32:15.321Z",
    "generatorURL": "http://interview:9090/graph?g0.expr=node_load1+%3E+1&g0.tab=1",
    "labels": {
      "alertname": "HostHighCpuLoad",
      "instance": "localhost:9100",
      "job": "prometheus",
      "severity": "warning"
    }
  }
]
No Comments
Back to top