You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem would you like to solve? Please describe:
The current implementation of the email alert template for Prometheus AlertManager is hardcoded and does not render the labels properly for email. Because webhook for the Prometheus Integration notifier sends all metadata in the request body, this needs to be supported on goalert to template the email body.
Describe the solution you'd like:
Add a way to support a customizable template for email alerts. This would allow users to define their own templates that render labels and other information correctly.
Describe alternatives you've considered:
One alternative is to improve the existing hardcoded template to ensure it renders correctly. However, this approach does not offer the flexibility that customizable templates provide.
Additional context:
The current code snippet for the email alert template is as follows:
if b.ExternalURL != "" {
fmt.Fprintf(&s, "[Prometheus Alertmanager UI](%s)\n\n", b.ExternalURL)
}
if b.CommonAnnotations.Details != "" {
s.WriteString(b.CommonAnnotations.Details + "\n\n")
} else {
for _, a := range b.Alerts {
s.WriteString(a.Details() + "\n\n")
}
}
if payload != "" {
fmt.Fprintf(&s, "## Payload\n\n```json\n%s\n```\n", payload)
}
return s.String()
We can envision to have something similar to email_config that is defined in AlertManager
{ define "custom_mail_subject" }}Alert on {{ range .Alerts.Firing }}{{ .Labels.instance }} {{ end }}{{ end }}
{{ define "custom_mail_html" }}
<html>
<head>
<title>Alert!</title>
</head>
<body>
{{ range .Alerts.Firing }}
<p>{{ .Labels.alertname }} on {{ .Labels.instance }}<br/>
{{ if ne .Annotations.summary "" }}{{ .Annotations.summary }}{{ end }}</p>
<p>Details:</p>
<p>
{{ range .Annotations.SortedPairs }}
{{ .Name }} = {{ .Value }}<br/>
{{ end }}
</p>
<p>
{{ range .Labels.SortedPairs }}
{{ .Name }} = {{ .Value }}<br/>
{{ end }}
</p>
{{ end }}
</body></html>
{{ end }}
The text was updated successfully, but these errors were encountered:
What problem would you like to solve? Please describe:
The current implementation of the email alert template for Prometheus AlertManager is hardcoded and does not render the labels properly for email. Because webhook for the Prometheus Integration notifier sends all metadata in the request body, this needs to be supported on goalert to template the email body.
Describe the solution you'd like:
Add a way to support a customizable template for email alerts. This would allow users to define their own templates that render labels and other information correctly.
Describe alternatives you've considered:
One alternative is to improve the existing hardcoded template to ensure it renders correctly. However, this approach does not offer the flexibility that customizable templates provide.
Additional context:
The current code snippet for the email alert template is as follows:
We can envision to have something similar to email_config that is defined in AlertManager
The text was updated successfully, but these errors were encountered: