shack/prometheus: add custom shack template
This commit is contained in:
parent
88aee4087e
commit
1394ae1bd4
@ -8,10 +8,10 @@
|
||||
DynamicUser = true;
|
||||
StateDirectory = "alertbot";
|
||||
ExecStart = ''${pkgs.alertmanager-bot-telegram}/bin/alertmanager-bot \
|
||||
--alertmanager.url=http://alert.prometheus.shack --log.level=info \
|
||||
--alertmanager.url=http://alert.prometheus.shack --log.level=debug \
|
||||
--store=bolt --bolt.path=/var/lib/alertbot/bot.db \
|
||||
--listen.addr="0.0.0.0:16320" \
|
||||
--template.paths=${pkgs.alertmanager-bot-telegram}/templates/default.tmpl'';
|
||||
--template.paths=${./templates}/shack.tmpl'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
25
krebs/2configs/shack/prometheus/templates/shack.tmpl
Normal file
25
krebs/2configs/shack/prometheus/templates/shack.tmpl
Normal file
@ -0,0 +1,25 @@
|
||||
{{ define "telegram.default" }}
|
||||
{{range .Alerts -}}
|
||||
{{ $severity := index .Labels "severity" }}
|
||||
{{ $desc := "No Description" }}
|
||||
{{ if eq .Status "firing" }}
|
||||
{{ $desc = index .Annotations "description" }}
|
||||
{{- if eq $severity "critical" -}}
|
||||
<i><u><b>[CRITICAL]</b></u></i>
|
||||
{{- else if eq $severity "warning" -}}
|
||||
<u><b>[WARNING]</b></u>
|
||||
{{- else -}}
|
||||
<b>[{{ $severity }}]</b>
|
||||
{{- end -}}
|
||||
{{ else -}}
|
||||
{{ $desc = "The issue has been resolved" }}
|
||||
<del>[RESOLVED]</del>
|
||||
{{- end }} {{ index .Labels "alertname"}}: {{ index .Annotations "summary"}}
|
||||
|
||||
{{ $desc }}
|
||||
|
||||
Alert Links:
|
||||
* <a href="{{ index .Annotations "url"}}">Grafana</a>
|
||||
* <a href="{{ .GeneratorURL }}">Source</a>
|
||||
{{end -}}
|
||||
{{end}}
|
Loading…
Reference in New Issue
Block a user