<p>I have a running Prometheus and configured alerts by alertmanager to my slack. and I am able to get the triggered alerts with its Description. For that I have added   the following in my config file.</p>

<pre><code>      Summary: '{{ range .Alerts }}{{ .Annotations.summary }} {{ end }}'

      Description: '{{ range .Alerts }}{{ .Annotations.description }} {{ end }}'
</code></pre>

<p>But now my issue is, the same description is generating, when the alerts are resolved. Is there any way to disable the Alert description for the resolved message?</p>

manu thankachan
<p>You will need to use the template to check the status of the alert (whether it is firing or resolved), and then set the content of the message conditionally based on that.</p>

<p>For example, the title field of my alerts gets set like this:</p>

<pre><code>{{ define "templatenamehere.title" }}
  {{- .Status | title }}
  {{- if eq .Status "firing" }} {{ .Alerts.Firing | len }}{{ else }} {{ .Alerts.Resolved | len }}{{ end }}
  {{- printf " - " }}
  {{- if gt (len .Alerts.Firing) 1 }}
  {{- .CommonLabels.alertname }}
  {{- else }}
  {{- .CommonAnnotations.summary }}
  {{- end }}
{{- end }}
</code></pre>
