DevOps/monitoring
grafana alert slack message template
rkrkrr0101
2022. 10. 27. 21:14
{{ define "alert_subject" }}
{{ if eq .Status "firing" }}
serverrestart( {{ .Labels.alertname }} )
{{end}}
{{ if eq .Status "resolved" }}
Resolved( {{ .Labels.alertname }} )
{{end}}
{{end}}
{{ define "alert_message" }}
{{ if eq .Status "firing" }}server:( {{ .Labels.namespace }} )
{{end}}{{ if eq .Status "firing" }}kind:( {{ .Labels.container }} )
{{end}}{{ if eq .Status "firing" }}pod:( {{ .Labels.pod }} )
{{end}}
{{ if eq .Status "resolved" }}
Resolved( {{ .Labels.alertname }} )
{{end}}
{{end}}
{{ define "alert_template" }}
{{ range .Alerts.Firing }}
{{ template "alert_message" .}}
{{end}}
{{end}}
serverrestart ,server:,kind:,pod: is plain text(This code is for kubernetes pod restart alarm)
When indenting, it is pushed back, so if there are more than two lines, you should not indent...(ex server:...kind:...)
왜 스트링내도 아니고 구문내에서 적는데 자동으로 띄워지는진 아직도 모르겠다...
도저히 찾다찾다 못찾아서 올림