Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prometheus / Alertmanager: remove link from slack notifications

Is it possible to remove the link that we get when AlertManager posts to Slack?

At the moment it's going to http://localhost:9093/.

like image 553
Snowcrash Avatar asked Feb 11 '26 02:02

Snowcrash


2 Answers

You can overwrite it with different link, for example the real one (can even try to pull null). Mind that default configuration is being used if you don't change it in Alertmanager receivers:

[ title_link: <tmpl_string> | default = '{{ template "slack.default.titlelink" . }}' ]

where

{{ define "slack.default.titlelink" }}{{ template "__alertmanagerURL" . }}{{ end }}

Please check your current config by going to <your_prometheus_url>:9093/#/status and then change configs in alertmanager.yml receivers: section.

Check slack_receiver configuration here: https://www.prometheus.io/docs/alerting/latest/configuration/#slack_config

Check this blog entry for some examples: https://prometheus.io/blog/2016/03/03/custom-alertmanager-templates/

like image 62
MichalTheDweller Avatar answered Feb 13 '26 15:02

MichalTheDweller


You can define the slack.default.titlelink template to be empty directly within the title_link (or titleLink when using the prometheus operator) definition, which will remove the link from the slack message title:

title_link: '{{ define "slack.default.titlelink" }}{{ "" }}{{ end }}'

Setting title_link: "" directly does not work, as alertmanager sees this as a value not being passed, and therefore uses the default template.

like image 42
flaviojohnson Avatar answered Feb 13 '26 14:02

flaviojohnson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!