Add Prometheus and Alertmanager configurations: implement custom rules, alerting, and Telegram notifications
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
{{/* Always produce a non-empty message. Handles single or multiple firing alerts and missing username. */}}
|
||||
{{ if gt (len .Alerts.Firing) 1 -}}
|
||||
<b>{{ len .Alerts.Firing }} logins</b> on {{ with .CommonLabels.cluster }}<b>{{ . }}</b>{{ else }}<b>unknown host</b>{{ end }}:
|
||||
{{- range .Alerts.Firing }}
|
||||
• {{ with .Labels.username }}<b>{{ . }}</b>{{ else }}<i>unknown</i>{{ end }} — Source: <code>{{ with .Labels.source }}{{ . }}{{ else }}?{{ end }}</code>{{ with .Labels.method }}, Method: <code>{{ . }}</code>{{ else }}, Method: <code>?</code>{{ end }}
|
||||
{{- end }}
|
||||
{{ else if eq (len .Alerts.Firing) 1 -}}
|
||||
{{ $a := index .Alerts.Firing 0 -}}
|
||||
<b>Login:</b> {{ with $a.Labels.username }}<b>{{ . }}</b>{{ else }}<i>unknown</i>{{ end }} on <b>{{ $a.Labels.cluster }}</b>
|
||||
Source: <code>{{ with $a.Labels.source }}{{ . }}{{ else }}?{{ end }}</code>{{ with $a.Labels.method }}, Method: <code>{{ . }}</code>{{ else }}, Method: <code>?</code>{{ end }}
|
||||
{{ else -}}
|
||||
<b>Login detected</b> — details unavailable.
|
||||
{{ end -}}
|
||||
Reference in New Issue
Block a user