AlertManager and prom2teams

428 views
Skip to first unread message

Bruno Cochofel

unread,
Apr 9, 2019, 4:32:40 AM4/9/19
to Prometheus Users
Hi,

I'm trying to configure alertmanager to send notifications to MS Teams and Slack. When I configure prom2teams I am unable to get notifications also on slack.
I've tried both using the binary and docker versions of prom2teams without sucess. I don't even get nothing write on the logfile. Using the WEB I am able to send messages to MS Team channel that I have.

I'm using 2 alertmanager servers in HA.

Version:
0.15.3

Thanks,
Bruno

Simon Pasquier

unread,
Apr 9, 2019, 10:45:27 AM4/9/19
to Bruno Cochofel, Prometheus Users
Can you share your AlertManager configuration? Remember to remove any
sensitive data as Slack webhook URLs.
> --
> 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-use...@googlegroups.com.
> To post to this group, send email to promethe...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/bc557047-abd8-4c54-8580-a50273a0b8aa%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Deep saraswat

unread,
Apr 9, 2019, 11:10:53 AM4/9/19
to Bruno Cochofel, Prometheus Users
Kindly share your alertmanager.yml. There must be something wrong with the configuration. Also, validate your yml file using a yaml validator.

Sent from my iPhone
--

Bruno Cochofel

unread,
Apr 9, 2019, 12:49:39 PM4/9/19
to Prometheus Users
Hi,

here is my configuration

--------------------------

global:
  resolve_timeout: 5m
  http_config:
    proxy_url: 'http://proxy.domain.com'

route:
  group_by: ['alertname']
  receiver: 'alertmanager'
  routes:
  - receiver: 'alertmanager-prod'
    match:
      env: prd

receivers:
- name: 'alertmanager'
  slack_configs:
    send_resolved: true
    channel: '#alertmanager'
    title: |-
      [{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }}
    text: >-
      {{ with index .Alerts 0 -}}
        :chart_with_upwards_trend: *<{{ .GeneratorURL }}|Graph>*
        {{- if .Labels.runbook }}   :notebook: *<{{ .Labels.runbook }}|Runbook>*{{ end }}
      {{ end }}

      *Alert details*:

      {{ range .Alerts -}}
        *Alert:* {{ .Annotations.summary }}{{ if .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}
      *Description:* {{ .Annotations.description }}

      *Details:*
        {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
        {{ end }}
      {{ end }}
  webhook_configs:
  - url: localhost:8089/v2/Connector
    send_resolved: true
    

- name: 'alertmanager-prod'
  slack_configs:
    channel: '#alertmanager-prod'
    send_resolved: true
    title: |-
      [{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }}
    text: >-
      {{ with index .Alerts 0 -}}
        :chart_with_upwards_trend: *<{{ .GeneratorURL }}|Graph>*
        {{- if .Labels.runbook }}   :notebook: *<{{ .Labels.runbook }}|Runbook>*{{ end }}
      {{ end }}

      *Alert details*:

      {{ range .Alerts -}}
        *Alert:* {{ .Annotations.summary }}{{ if .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}
      *Description:* {{ .Annotations.description }}

      *Details:*
        {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
        {{ end }}
      {{ end }}
  webhook_configs:
  - url: localhost:8089/v2/Connector
    send_resolved: true

----------------

Bruno Cochofel

unread,
Apr 10, 2019, 3:28:26 AM4/10/19
to Prometheus Users
Hi, 

I'm wondering if the proxy_url defined is the problem.

Can I define the proxy only for slack configuration and let webhook reach localhost?

Thanks,
Bruno

--
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/eo1NP_pyzAE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.

To post to this group, send email to promethe...@googlegroups.com.

Simon Pasquier

unread,
Apr 10, 2019, 3:45:11 AM4/10/19
to Bruno Cochofel, Prometheus Users
On Wed, Apr 10, 2019 at 9:28 AM Bruno Cochofel <bruno.c...@gmail.com> wrote:
>
> Hi,
>
> I'm wondering if the proxy_url defined is the problem.
>
> Can I define the proxy only for slack configuration and let webhook reach localhost?

It might be.

You can either remove the http_config section in global and define the
proxy for each Slack receiver or keep the global config untouched and
specify an empty hash for the webhook receiver.

- name: 'alertmanager-prod'
slack_configs:
- api_url: ...
http_config:
proxy_url: ...

or

webhook_configs:
- url: localhost:8089/v2/Connector
http_config: {}
> 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-use...@googlegroups.com.
> To post to this group, send email to promethe...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAEt%3D3VWrtwArpL30yav_Lt2Ae%2BK0Z_P%2By3m125Jrpi4jcVi%2Bvw%40mail.gmail.com.

Bruno Cochofel

unread,
Apr 10, 2019, 6:13:13 AM4/10/19
to Prometheus Users
Hi,

I've tried changing proxy configuration but still am unable to receive notifications on MS Teams.

Bruno


On Tuesday, April 9, 2019 at 9:32:40 AM UTC+1, Bruno Cochofel wrote:

Simon Pasquier

unread,
Apr 10, 2019, 6:43:37 AM4/10/19
to Bruno Cochofel, Prometheus Users
Any error in the Alertmanager logs? Same question for the webhook server.
> --
> 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-use...@googlegroups.com.
> To post to this group, send email to promethe...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/0c273e9d-7d8d-448c-a5db-2db3c8cd3cd7%40googlegroups.com.

Bruno Cochofel

unread,
Apr 10, 2019, 5:15:52 PM4/10/19
to Prometheus Users
Hi,

I've managed to put this to work changing the url to http://<server ip>:8089/v2/Connector

Thanks for all the help,
Bruno

On Tuesday, April 9, 2019 at 9:32:40 AM UTC+1, Bruno Cochofel wrote:
Reply all
Reply to author
Forward
0 new messages