What kind of changes need to be made to a slack template in order to reuse into Jiralert one? Can I utilize the whole body as it is, can somebody post an example of a working resuse, even for the default example in vendor site.
Asked
Active
Viewed 222 times
1 Answers
1
In the end solved it myself, I had to just define jira.summary and description respectively and copy/paste the contents from the slack integration in the given fields.
{{ define "jira.summary" }}]
{{ .Alerts.Firing | len }} {{ .CommonLabels.alertname }} for {{ .CommonLabels.job }}
{{- if gt (len .CommonLabels) (len .GroupLabels) -}}
{{" "}}(
{{- with .CommonLabels.Remove .GroupLabels.Names }}
{{- range $index, $label := .SortedPairs -}}
{{ if $index }}, {{ end }}
{{- $label.Name }}="{{ $label.Value -}}"
{{- end }}
{{- end -}}
)
{{- end }}
{{- end }}
{{ define "jira.description" }}
{{ with index .Alerts 0 -}}
:chart_with_upwards_trend: *<{{ .GeneratorURL }}|Graph>*
{{- if .Annotations.runbook }} :notebook: *<{{ .Annotations.runbook }}|Runbook>*{{ end }}
{{ end }}
*Kubernetes Cluster:* `default`
*Prometheus Alert Details*:
{{ range .Alerts -}}
*Prometheus Alert:* {{ .Annotations.title }}{{ if .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}
*Prometheus Alert Description:* {{ .Annotations.message }}
*Prometheus Alert Details:*
{{ range .Labels.SortedPairs }} *{{ .Name }}:* `{{ .Value }}`
{{ end }}
{{ end }}
{{- end }}
anVzdGFub3RoZXJodW1hbg
- 482
- 2
- 7
- 15