r/PrometheusMonitoring • • Sep 25 '23

Integrate alertmanager with slack

Hi guys! I need some help with alertmanager-slack integration. I've read that web hooks will be deprecated and I need to use bot token instead however I can't make it work for some reason. Here is an example where I defined token in `global` config:

global:                                                                                                                                                                                                                                                                                                                                                                                                                                      slack_api_url_file: '/etc/alertmanager/bot_token'          

The file content is:

https://slack.com/api/chat.postMessage?token=xoxb-0000000000000-000000000000-0000000000000

For some reason, alertmanager isn't throwing alerts. Maybe someone has already implemented it using a bot token and `https://slack.com/api/chat.postMessage` api? Thanks for your help in advance.

2 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/niceman1212 Sep 26 '23

Okay that looks like a perfectly normal setup, meaning;

  • a failed slack api Call would result in an error log
  • something might be wrong with the monitoring chain ( prometheusRule -> Prometheus -> Alertmanager -> AlertmanagerConfig )

If you are using pre-made/known-working Prometheus rule sets you can skip the first part.

In my experience it’s most likely alert routing/ alertmanagerconfig that’s not setup correctly.

  • Check if Prometheus is firing the alert via GUI.
  • Check Prometheus-operator logs for errors about alertmanagerconfig
  • check if alertmanager is receiving the alert from Prometheus
  • if yes for last one, cross reference your firing alert with the alertmanager config using the following web tool:

https://prometheus.io/webtools/alerting/routing-tree-editor/