grafana / mimir

Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.
https://grafana.com/oss/mimir/
GNU Affero General Public License v3.0
4.16k stars 535 forks source link

Support customizing default alertmanager templates #5460

Open stevesg opened 1 year ago

stevesg commented 1 year ago

Is your feature request related to a problem? Please describe.

The default templates for alertmanager are inherited from upstream and therefore hardcoded into the binary, making them hard to modify without rebuilding Mimir. There are at least two use cases where being able to customize these templates could be valuable for an operator of Mimir Alertmanager:

For example - to change the links to the Alertmanager UI, this could be put in the template:

{{ define "__alertmanagerURL" }}https://grafana.example.com/alerting/groups{{ end }}

Describe the solution you'd like

A new optional configuration option to specify a template file. This template would be loaded after the default templates, but before user templates. Effectively this just means the "operator"/"override" template will be inserted into the template files passed here, before all other user templates: https://github.com/grafana/mimir/blob/9cc3f40a2da5a7488926a8841b34b1f40a34a56b/pkg/alertmanager/alertmanager.go#L324

Describe alternatives you've considered

pstibrany commented 1 year ago

Seems reasonable to me, would you like to send a PR implementing this?

rgarrigue commented 2 months ago

I'm also interested in this one, can someone push it forward ?