Add dashboard UID auto-generation and Gitea CI workflow
This commit is contained in:
@ -0,0 +1,60 @@
|
||||
{{ define "custom_alert.title" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}: {{ .Alerts.Firing | len }}{{ if gt (.Alerts.Resolved | len) 0 }}, RESOLVED: {{ .Alerts.Resolved | len }}{{ end }}{{ end }}]{{ if gt (len .GroupLabels) 0 }} Grouped by: {{ range .CommonLabels.SortedPairs }}{{ .Name }}: {{ .Value }}{{ end }}{{ end }}{{ end }}
|
||||
|
||||
{{ define "__text_alert_name" }}{{ range .Labels.SortedPairs }}{{ if eq .Name "alertname" }}{{ .Value }}{{ end }}{{ end }}{{ end }}
|
||||
{{ define "__text_alert_summary" }}{{ range .Annotations.SortedPairs }}{{ if eq .Name "summary" }}{{ .Value }}
|
||||
{{ end }}{{ end }}{{ end }}
|
||||
{{ define "__text_alert_description" }}{{ range .Annotations.SortedPairs }}{{ if eq .Name "description" }}{{ .Value }}{{ end }}{{ end }}{{ end }}
|
||||
{{ define "__text_alert_runbook_url" }}{{ range .Annotations.SortedPairs }}{{ if eq .Name "runbook_url" }}
|
||||
:bookmark_tabs: <{{ .Value }}|Playbook>{{ end }}{{ end }}{{ end }}
|
||||
|
||||
{{ define "__text_alert_firing_item" }}:bell:
|
||||
{{ $alertName := (index .Labels "alertname") }}
|
||||
Labels: {{ range .Labels.SortedPairs }}
|
||||
{{- if ne .Name "alertname" }}
|
||||
{{- if ne .Name "ref_id" }}
|
||||
{{- if ne .Name "datasource_uid" }}
|
||||
{{- if ne .Name "rule_uid" }}
|
||||
- {{ if and (eq .Name "cluster") (eq $alertName "Kube-apiserver or blackbox is down") }}request_from_cluster{{ else }}{{ .Name }}{{ end }} = {{ .Value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
Actions:
|
||||
{{ if gt (len .DashboardURL) 0 }}➡️ <{{ .DashboardURL }}|Go to dashboard>{{ end }}
|
||||
{{ if gt (len .PanelURL) 0 }}:chart_with_upwards_trend: <{{ .PanelURL }}|Go to panel>{{ end }}
|
||||
{{ if gt (len .GeneratorURL) 0 }}:arrow_right: <{{ .GeneratorURL }}|Go to alert>{{ end }}
|
||||
{{ if gt (len .SilenceURL) 0 }}:mute: <{{ .SilenceURL }}|Silence alert>{{ end }}{{ template "__text_alert_runbook_url" . }}{{ end }}
|
||||
|
||||
{{ define "__text_alert_resolved_item" }}:large_green_circle: {{ template "__text_alert_name" . }}
|
||||
{{ $alertName := (index .Labels "alertname") }}
|
||||
Labels: {{ range .Labels.SortedPairs }}
|
||||
{{- if ne .Name "alertname" }}
|
||||
{{- if ne .Name "ref_id" }}
|
||||
{{- if ne .Name "datasource_uid" }}
|
||||
{{- if ne .Name "rule_uid" }}
|
||||
- {{ if and (eq .Name "cluster") (eq $alertName "Kube-apiserver or blackbox is down") }}request_from_cluster{{ else }}{{ .Name }}{{ end }} = {{ .Value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
Actions:
|
||||
{{ if gt (len .DashboardURL) 0 }}➡️ <{{ .DashboardURL }}|Go to dashboard>{{ end }}
|
||||
{{ if gt (len .PanelURL) 0 }}:chart_with_upwards_trend: <{{ .PanelURL }}|Go to panel>{{ end }}
|
||||
{{ if gt (len .GeneratorURL) 0 }}:arrow_right: <{{ .GeneratorURL }}|Go to alert>{{ end }}{{ end }}
|
||||
|
||||
{{ define "__text_alert_list_firing" }}{{ range . }}
|
||||
|
||||
{{ template "__text_alert_firing_item" . }}{{ end }}{{ end }}
|
||||
|
||||
{{ define "__text_alert_list_resolved" }}{{ range . }}
|
||||
|
||||
{{ template "__text_alert_resolved_item" . }}{{ end }}{{ end }}
|
||||
|
||||
{{ define "custom_alert.message" }}
|
||||
{{ if gt (len .Alerts.Firing) 0 }}{{ .Alerts.Firing | len }} Firing{{ template "__text_alert_list_firing" .Alerts.Firing }}{{ end }}
|
||||
|
||||
{{ if gt (len .Alerts.Resolved) 0 }}{{ .Alerts.Resolved | len }} Resolved{{ template "__text_alert_list_resolved" .Alerts.Resolved }}{{ end }}{{ end }}
|
||||
Reference in New Issue
Block a user