需要对松弛的模板进行什么样的更改才能将其重用到Jir预警1中?我能不能利用整个身体的现状,有人可以张贴一个例子的工作,即使是默认的例子在供应商的网站。
发布于 2020-05-14 08:26:56
最后,我自己解决了这个问题,我不得不分别定义jira.summary和description,并在给定字段中复制/粘贴松弛集成中的内容。
{{ 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 }}
https://devops.stackexchange.com/questions/11596
复制相似问题