aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/namespaces/monitoring/alerts/alertmanager.yaml
blob: f347b2bccda482a4872cec533e9465d925a61e5d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
route:
  group_by: ["alertname", "cluster", "service"]
  receiver: devops-team

  group_wait: 15s

  group_interval: 1m

  routes:
    - receiver: devops-team
      continue: true
    - receiver: pagerduty
      matchers:
        - severity="page"
      continue: true
    - receiver: email
      continue: true

receivers:
  - name: devops-team
    slack_configs:
      - api_url_file: "/opt/pydis/alertmanager/webhooks/DEVOPS_HOOK"
        send_resolved: true
        title: '{{ if eq .Status "firing" }}[FIRING]{{ else }}[RESOLVED]{{ end }}'
        text: |
          {{ if eq .Status "firing" }}{{ range .Alerts }}
          {{ if .Labels.instance }}`{{ .Labels.instance }}`: {{ end }}**{{ .Annotations.summary }}:**
          {{ .Annotations.description }} [(Link)]({{.GeneratorURL}})

          {{ end }}{{ else }}Alert has resolved.{{ end }}
        fields:
          - title: Alert
            value: "{{ .GroupLabels.alertname }}"
  - name: pagerduty
    pagerduty_configs:
      - routing_key_file: "/opt/pydis/alertmanager/webhooks/PAGERDUTY_KEY"
        url: https://events.pagerduty.com/v2/enqueue
  - name: email
    email_configs:
      - to: [email protected]
        send_resolved: true
        from: [email protected]
        smarthost: mail.pydis.wtf:587
        auth_username: [email protected]
        auth_password_file: /opt/pydis/alertmanager/webhooks/EMAIL_PASSWORD
        text: |
          {{ .CommonAnnotations.summary }}

          {{ .CommonAnnotations.description }}

          {{ if eq .Status "firing" }}{{ range .Alerts }}
          {{ if .Labels.instance }}{{ .Labels.instance }}: {{ end }}{{ .Annotations.summary }}:
          {{ .Annotations.description }}

          {{ .GeneratorURL }}

          {{ end }}{{ else }}Alert has resolved.{{ end }}