Answers: <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>
  
Answers: CC BY-SA 4.0
Answers: 2020-05-14T08:26:56.513Z
Answers: 2020-05-14T08:26:56.513Z
Answers: anVzdGFub3RoZXJodW1hbg
Body: <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>
  
Tags: <prometheus><jira><go>
Title: Reuse Alertmanger Slack Integration into Jiralert template
UserDisplayName: anVzdGFub3RoZXJodW1hbg
ThreadText: # 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 }}
  
  ```
  
  
  ---
  
  