forked from navikt/sokos-utbetalingsportalen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalerts-prod.yaml
78 lines (75 loc) · 2.45 KB
/
alerts-prod.yaml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: sokos-op-fasade
namespace: okonomi
labels:
team: okonomi
spec:
groups:
- name: sokos-op-fasade-alerts
rules:
- alert: Applikasjon nede
expr: kube_deployment_status_replicas_available{deployment="sokos-op-fasade"} == 0
for: 2m
annotations:
action: "Sjek hvorfor applikasjonen er nede"
summary: "App {{ $labels.deployment }} er nede i namespace {{ $labels.namespace }}"
labels:
namespace: okonomi
severity: danger
sokos_op_fasade_type: sokos-op-fasade
alert_type: custom
- alert: Applikasjonen har restartet flere ganger de siste 5 minuttene!
expr: sum(increase(kube_pod_container_status_restarts_total{container=~"sokos-op-fasade"}[5m])) by (container) > 2
for: 2m
annotations:
action: "Sjekk hvorfor applikasjonen ikke klarer å restarte"
summary: "App {{ $labels.container }} restarter mange ganger"
labels:
namespace: okonomi
severity: danger
sokos_op_fasade_type: sokos-op-fasade
alert_type: custom
---
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
name: sokos-op-fasade-slack
namespace: okonomi
labels:
alertmanagerConfig: sokos-op-fasade-slack
spec:
receivers:
- name: sokos-op-fasade-receiver
slackConfigs:
- apiURL:
key: apiUrl
name: slack-webhook
channel: '#team-mob-alerts-prod'
iconEmoji: ':alert:'
username: 'Alert prod-gcp'
sendResolved: true
title: |-
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }}
text: >-
{{ range .Alerts }}
{{ if or .Annotations.summary .Annotations.message }}
{{ or .Annotations.summary .Annotations.message }}
{{ println " " }}
{{- end }}
{{- if .Annotations.action }}
• *action*: {{ .Annotations.action }} {{ println " " }}
{{- end }}
{{ end }}
route:
groupBy:
- alertname
matchers:
- name: "sokos_op_fasade_type"
matchType: "="
value: "sokos-op-fasade"
groupInterval: 10s
groupWait: 5s
receiver: sokos-op-fasade-receiver
repeatInterval: 2m