Integration with prometheus - mapping parameters to alert fields




im search for a way to convert the prometheus labels into opsgenie tags. Is there any to convert during alert creation the labels into tags? Or make at least the labels viewable in the opsgenie alert message?


Hi Sven,

Normally that would be possible via the dynamic fields if the integration parameter mapping is done on our side. However, for Prometheus, we are providing a generic API endpoint and the customization is done in the Alertmanager on the other side.

I’m nowhere near familiar with Prometheus, but I believe you have the ability to map labels to the tags parameter in the Receiver settings.

I found this looking for customization options:

Based on this, probably you could do something like:

- name: "opsgenie" 
- api_key: xxx 
teams: TeamA 
tags: '{{ range .Alerts }}{{ .Labels.instance }} {{ end }}'

This will take the instance label and add it as a tag. You can play around with those Go templates to get all the labels you are interested.

You think this is enough to get you started?