-
Notifications
You must be signed in to change notification settings - Fork 0
/
08-prometheus-bot-configmap.yaml
100 lines (93 loc) · 3.26 KB
/
08-prometheus-bot-configmap.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-bot-config
namespace: monitoring
data:
prometheus-bot.yml: |-
telegram_token: "<Your Telegram bot Token>"
template_path: "/etc/telegrambot/alert-template.tmpl"
time_zone: "<Your Time Zone>"
split_token: "|"
split_msg_byte: 4096
alert-template.tmpl: |-
{{if eq .CommonLabels.alertname "High Node Memory" -}}
{{ range .Alerts }}
Alertname: <b>{{ .Labels.alertname }}</b>
Summary: <b>{{ .Annotations.summary }}</b>
Node: <b>{{ .Labels.node }}</b>
Memory Capacity: <b>{{ .Labels.value }} MiB</b>
Severity: <b>{{ .Labels.severity }}</b>
Status: <b>{{ .Status }}</b>
{{ end }}
{{ end -}}
{{if eq .CommonLabels.alertname "High Pod Memory" -}}
{{ range .Alerts }}
Alertname: <b>{{ .Labels.alertname }}</b>
Summary: <b>{{ .Annotations.summary }}</b>
Node: <b>{{ .Labels.instance }}</b>
Pod: <b>{{ .Labels.pod }}</b>
Memory Pod Usage: <b>{{ .Labels.value }} MiB</b>
Severity: <b>{{ .Labels.severity }}</b>
Status: <b>{{ .Status }}</b>
{{ end }}
{{ end -}}
{{if eq .CommonLabels.alertname "High Cluster CPU" -}}
{{ range .Alerts }}
Alertname: <b>{{ .Labels.alertname }}</b>
Summary: <b>{{ .Annotations.summary }}</b>
CPU Cluster Usage: <b>{{ .Labels.value }} %</b>
Severity: <b>{{ .Labels.severity }}</b>
Status: <b>{{ .Status }}</b>
{{ end }}
{{ end -}}
{{if eq .CommonLabels.alertname "High Node CPU" -}}
{{ range .Alerts }}
Alertname: <b>{{ .Labels.alertname }}</b>
Summary: <b>{{ .Annotations.summary }}</b>
Node: <b>{{ .Labels.instance }}</b>
CPU Node Usage: <b>{{ .Labels.value }} %</b>
Severity: <b>{{ .Labels.severity }}</b>
Status: <b>{{ .Status }}</b>
{{ end }}
{{ end -}}
{{if eq .CommonLabels.alertname "Pod CrashLooping" -}}
{{ range .Alerts }}
Alertname: <b>{{ .Labels.alertname }}</b>
Summary: <b>{{ .Annotations.summary }}</b>
Namespace: <b>{{ .Labels.namespace }}</b>
Pod: <b>{{ .Labels.pod }}</b>
Severity: <b>{{ .Labels.severity }}</b>
Status: <b>{{ .Status }}</b>
{{ end }}
{{ end -}}
{{if eq .CommonLabels.alertname "Node Failover" -}}
{{ range .Alerts }}
Alertname: <b>{{ .Labels.alertname }}</b>
Summary: <b>{{ .Annotations.summary }}</b>
Node: <b>{{ .Labels.node }}</b>
Node Status: <b>{{ .Labels.status }}</b>
Severity: <b>{{ .Labels.severity }}</b>
Status: <b>{{ .Status }}</b>
{{ end }}
{{ end -}}
{{if eq .CommonLabels.alertname "Swap Memory" -}}
{{ range .Alerts }}
Alertname: <b>{{ .Labels.alertname }}</b>
Summary: <b>{{ .Annotations.summary }}</b>
Node: <b>{{ .Labels.instance }}</b>
Swap Memory Value: <b>{{ .Labels.value }} MiB</b>
Severity: <b>{{ .Labels.severity }}</b>
Status: <b>{{ .Status }}</b>
{{ end }}
{{ end -}}
{{if eq .CommonLabels.alertname "High Disk Space" -}}
{{ range .Alerts }}
Alertname: <b>{{ .Labels.alertname }}</b>
Summary: <b>{{ .Annotations.summary }}</b>
Node: <b>{{ .Labels.instance }}</b>
Percentage Disk Usage: <b>{{ .Labels.value }} %</b>
Severity: <b>{{ .Labels.severity }}</b>
Status: <b>{{ .Status }}</b>
{{ end }}
{{ end -}}