Prometheus/Alertmanager: Create tags in OpsGenie from Alerts

586 views
Skip to first unread message

vikram yerneni

unread,
Jun 2, 2020, 5:53:42 PM6/2/20
to Prometheus Users
Fellas,
I am not a developer here, so asking in layman terms. 
I am trying to set integration between Prometheus/Alertmanager with OpsGenie and alerts to get route to multiple teams using "tags" option in OpsGenie. 
So in order to set the tags field, it seems that can be achieved from Alertmanager configuration (this is managed from Alertmanager configuration) or even from individual alerts (this is managed from Prometheus configuration).

Please see below for the Alertmanager configuration (the "tags" part didn't worked): 
apiVersion: v1
data:
  alertmanager.yml: |
    global:
      opsgenie_api_key: “”
      opsgenie_api_url: https://api.opsgenie.com/
      resolve_timeout: 1m
    receivers:
    - name: saas-ops
      opsgenie_configs:
      - send_resolved: true
        teams: Operations
        tags: nonprod
        tags: '{{ range .Alerts }}{{ .Labels.Values | join "," }}{{end}}'
        priority: '{{ range .Alerts }}{{ if eq .Labels.severity "critical"}}P1{{else}}P3{{end}}{{end}}'
      - api_key: “”
        api_url: https://api.opsgenie.com/
        responders:
        - name: teamname
          type: team
    route:
      group_interval: 1m
      group_wait: 10s
      receiver: saas-ops
      repeat_interval: 1m



I am little confused on how to achieve this fellas...


Thanks
Vikram Y

Matthias Rampke

unread,
Jun 3, 2020, 2:54:33 AM6/3/20
to vikram yerneni, Prometheus Users
You are setting the `tags` key twice, that probably has unintended consequences. What are the labels on the alert? What tags end up being set in OpsGenie?

/MR

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/221fc025-af67-48ba-96db-c85871722a76%40googlegroups.com.

vikram yerneni

unread,
Jun 3, 2020, 12:50:05 PM6/3/20
to Prometheus Users
Hi Matthias,
Sorry this part (tags: nonprod) is a typo in my post. Without the typo, I am not getting any tags in the OpsGenie at all. Literally nothing. 
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages