Skip to content

Commit

Permalink
(fleet/alerts) include cluster in slack alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
fbegyn committed May 26, 2024
1 parent b2a0207 commit d265dc6
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ metadata:
data:
slack-generic-alert.tmpl: |
{{ define "slack.o11y.generic.text" }}
*Site:* {{ .CommonLabels.site }}
*Site:* {{ .CommonLabels.prom_site }}
*Alert:* {{ .GroupLabels.alertname }}
*Summary:* {{ .CommonAnnotations.summary }}
{{ template "__o11y_alert_list" . }}
{{ template "__o11y_alert_short_list" . }}
{{ end }}
{{ define "slack.o11y.generic.title"}}
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.prom }}/{{ .GroupLabels.alertname }}
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.prom_cluster }}/{{ .GroupLabels.alertname }}
{{ end }}
slack-kube-alert.tmpl: |
{{ define "slack.o11y.kube.text" }}
*Alert:* {{ .GroupLabels.alertname }}
*Site:* {{ .CommonLabels.site }}
*Kube cluster:* {{ .CommonLabels.prom }}
*Site:* {{ .CommonLabels.prom_site }}
*Kube cluster:* {{ .CommonLabels.prom_cluster }}
*Namespace:* {{ .GroupLabels.namespace }}
*Summary:* {{ .CommonAnnotations.summary }}
{{ template "__o11y_alert_list" . }}
{{ end }}
{{ define "slack.o11y.kube.title"}}
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.prom }}/{{ .GroupLabels.namespace }}/{{ .GroupLabels.alertname }}
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.prom_cluster }}/{{ .GroupLabels.namespace }}/{{ .GroupLabels.alertname }}
{{ end }}
slack-network-alert.tmpl: |
{{ define "slack.o11y.network.text" }}
Expand All @@ -36,12 +36,13 @@ data:
{{ template "__o11y_alert_list" . }}
{{ end }}
template-helpers.tmpl: |
{{ define "__o11y_alert_title" }}
{{ end }}
{{ define "__o11y_alert_list" }}
*Alerts:*
=========
{{ range .Alerts -}}
- *Alert:* {{ .Labels.alertname }}
*Summary:* {{ .Annotations.summary }}
*Description:* {{ .Annotations.description }}
*Severity:* {{ .Labels.severity }}
*Time:* {{ .StartsAt.Format "2006-01-02 15:04:05 MST" }}
Expand All @@ -51,3 +52,13 @@ data:
{{ end }}
{{ end }}
{{ end }}
{{ define "__o11y_alert_short_list" }}
*Alerts:*
=========
{{ range .Alerts -}}
- *Alert:* {{ .Labels.alertname }}
*Description:* {{ .Annotations.description }}
*Severity:* {{ .Labels.severity }}
*Time:* {{ .StartsAt.Format "2006-01-02 15:04:05 MST" }}
{{ end }}
{{ end }}

0 comments on commit d265dc6

Please sign in to comment.