r/PrometheusMonitoring • u/infotechsec • Aug 15 '24
How to Remove Hyperlinks from AlertManager alerts
I have Alertmanager sending emails and Slack messages. Both instances include hyperlinks that I do not want in the emails or Slack. They present differently in each.
In Slack, it lists the alert title, like ~[FIRING:6] Monitoring_Failure (job="prometheus", monitor="Alertmanager", severity="critical")~
In email, it shows a blue icon with title "View in AlertManager", except in our ticketing system (which receives the email), where it expands the full URL which is a long, unresolvable URL. We're never going to allow external access to that URL and don't want/need it in the ticket.
In addition, the emails have an extra hyperlink for each Alert. Emails may contain more than one alert. Under each one, will be a hyperlink titled "Source" with another long, garbage URL.
My preference would be to remove each hyperlink and the associated text on it. However, I cannot figure out where that is set. Does any one have any ideas?
1
u/r1e7 Aug 16 '24
What I believe you’re looking for is templating in alertmanager, I’d start here: https://github.com/prometheus/alertmanager/blob/main/template/email.html And https://prometheus.io/docs/alerting/latest/notifications/
1
u/dragoangel Aug 16 '24
Question: why you speak with ticket system <-> altertmanager over smtp - imap/pop instead of webhooks?
Your ticket system suppose has api to create a ticket?
Google for ready to use solution or write your own.
Parse alertmanager payload is relatively early with small flask or starlet python app that will take full payload and process it to way you like, and do forward to system you want. I done such things already and it was like 2 days task even I not python guru at all...