Alertmanager - Custom parameters not working in slack_config like icon_url etc.

472 views
Skip to first unread message

m.przy...@biotcloud.com

unread,
Jul 19, 2018, 9:49:37 AM7/19/18
to Prometheus Users

Hello,
I would like to customize my alertmanager deployment, and so far everything works great, notifications are sent correctly via AlertManager to my slack channel, but i've found that there are some cool things which may be customized like image on the left side of the alert, username etc. I've added icon_url & username parameters but they seems to not working. Custom icon is not showing at all and also username doesn't change - here's output from my values, as this is templated by Helm chart.

Prometheus version 2.2.2
Alertmanager version 0.15.1

    - name: 'myname'
      slack_configs:
      - channel: '#alerts'
        username: 'Alerting System'
        icon_url: 'https://i.imgur.com/BeNCJG5.png'
        title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Prometheus Event Notification'
        text: >-
            {{ range .Alerts }}
               *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
              *Description:* {{ .Annotations.description }}
              *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:> *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>
              *Details:*
              {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
              {{ end }}
            {{ end }}
        send_resolved: true


Any ideas how to solve or what i'm missing here ?


Regards.

Simon Pasquier

unread,
Jul 19, 2018, 10:29:47 AM7/19/18
to m.przy...@biotcloud.com, Prometheus Users
It may be that the Slack API for incoming webhook has changed.

Reading [1], it says:

"You cannot override the default channel (chosen by the user who installed your app), username, or icon when you're using Incoming Webhooks to post messages. Instead, these values will always inherit from the associated Slack app configuration."

Can you try a simple cURL request like this?

curl -X POST \
-H 'Content-type: application/json' \
--data '{"text": "This is a test.", "channel": "#general", "username": "monkey-bot", "icon_emoji": ":monkey_face:"}' \
https://your_webhook_url/

[1] https://api.slack.com/incoming-webhooks

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/6f84acbe-7376-4f3b-bbb2-11e8a7620a1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages