<p>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.</p>

<pre><code>{{ 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: *&lt;{{ .GeneratorURL }}|Graph&gt;*
    {{- if .Annotations.runbook }}   :notebook: *&lt;{{ .Annotations.runbook }}|Runbook&gt;*{{ 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 }}
</code></pre>

CC BY-SA 4.0
2020-05-14T08:26:56.513Z
2020-05-14T08:26:56.513Z
anVzdGFub3RoZXJodW1hbg
<p>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.</p>

<prometheus><jira><go>
Reuse Alertmanger Slack Integration into Jiralert template
anVzdGFub3RoZXJodW1hbg
# Reuse Alertmanger Slack Integration into Jiralert template

(Asked by: username_0 on 2020-05-13)

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.

**Tags:** prometheus, jira, go


---

## 1 answers

### Answer by username_0 on 2020-05-14. Score: 1 | Accepted answer

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 }}


---

