Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to set Opsgenie alert priority from Prometheus alert priority


I have the priority level in Prometheus set as 'severity' with values low,medium and critical. I tried using Opsgenie's 'Custom Value to Opsgenie priority' option with value {{severity.substring(0,2)}} but that does not seem to change the priority level of the Opsgenie alert. What am I missing here? Can someone please help me.


4 answers

My prometheus+alertmanager work fine with priorities!


in prometheus, i have this alert:

- alert: Instance_Free_Inodes
expr: (disk_inodes_used * 100 / disk_inodes_total) > 75
for: 5m
severity: page
alert_target: '{{ $ }}'
description: '{{ $labels.alias }} of job {{ $labels.job }} ({{ $labels.path }}) has ({{ $value | printf "%.2f" }})% used inodes for more than 5 minutes.'
summary: {{ $labels.alias }} using more than 75% inodes on {{ $labels.path }}
impact: Services may fail
action: Check the server disks and remove some files, if possible
priority: P3

Then in alertmanager:

- name: opsgenie_techops_team
    - send_resolved: true
      http_config: {}
      api_key: <secret>>
      message: '{{ template "opsgenie.default.message" . }}'
      description: '{{ template "opsgenie.default.description" . }}'
      source: '{{ template "opsgenie.default.source" . }}'
      - name: techops_team
         type: team
      priority: '{{ if .CommonAnnotations.priority }}{{ .CommonAnnotations.priority
}}{{ else }}P3{{ end }}'



This way i can setup the priority in the prometheus alert and it is pushed to opsgenie correctly

Hi Folks,


Posting my configuration which works well with severity mapping to priority in opsgenie as follows:


critical => P1

warning => P2

info => P3

none => P4


Configuration for Alertmanager I used as follows:

resolve_timeout: 1m
opsgenie_api_key: <my-top-secret-api-key>
- opsgenie_configs:
- teams: <my-team-name>
priority: '{{ range .Alerts }}{{ if eq .Labels.severity "critical"}}P1{{else if eq .Labels.severity "warning"}}P2{{else if eq .Labels.severity "info"}}P3{{else}}P4{{end}}{{end}}'
name: opsgenie
group_by: ['...']
receiver: opsgenie
repeat_interval: 5m

I tested this with Opsgenie free tier with Prometheus Alertmanager.


Please mind indentations while configuring.


Final Note: please input api-key, team name accordingly, also group_by etc fields are not optimised, I tested this with bare 4 alerts having specific severity what I mentioned above.

0 votes
Nick H Atlassian Team Oct 25, 2019

Hi Ashman,

I think you are on the right track, but missing one character. Can you try this string instead:


The priority is touchy in this sense that it needs a hardcoded 'P' to map to our priorities.

Let us know if this does the trick! If not, I may need to take a look at what the logs are parsing or what the severity looks like.

@Nick H Thanks for the response. I tried what you suggested but that did not seem to work. Please take a look and let me know about the workaround. Thanks!

0 votes
Nick H Atlassian Team Nov 12, 2019

With Prometheus' Alert Manager config file you should be able to map the severity field with something customer like this:

priority: '{{ range .Alerts }}{{ if eq .Labels.severity "critical"}}P1{{else}}P3{{end}}{{end}}'

You can always change "P1" "P3" to their preference.


@Nick H Thanks! I tried that out and it maps  priority to P1 for critical alerts but I still wonder why does the one on Opsgenie portal did not work out. ie,  Setting 'Custom Value to Opsgenie priority' option with value {{severity.substring(0,2)}} 

Any update on this yet?

Nick H Atlassian Team Nov 18, 2019

I'm realizing Prometheus unfortunately is not an integration that can have a custom value to Opsgenie property configured such as a value {{severity.substring(0,2)}}:

priority image.jpg


So the best option is mapping this on the Alert Manager side like shown above. We also see customers using Alert Policies to parsed for the severity field, and modify/map the alert's priority this way, but these policies are only included in our Standard and Enterprise plans:

Like Darryl Lee likes this

apologies, but i'm not satisfied with your answer. If you say Prometheus is not an integration that can have a custom value to Opsgenie property, why is the option 'Custom Value to Opsgenie priority' even included in Prometheus integration page? If that cannot have values like '{{severity.substring(0,2)}}' what other values can it have? Can you please give me an example so that I understand the feature better?

Nick H Atlassian Team Nov 18, 2019

It's not an option (unless you are seeing something else with your integration):

priorty 2.jpg

Prometheus is using an API key to post to Opsgenie and because of this, looking for the values that are priority is (P1-5).


This is what I see and I would like to know  how to use it and what values does it take.Opsgenie.png

Nick H Atlassian Team Nov 19, 2019

You can use this option (Custom Value to Opsgenie Priority) with other webhook-based integrations. Unfortunately it does not work with our API integrations such as Prometheus.

Prometheus is an integration that sends notifications through our API ( and due to this - Opsgenie will be looking for exactly this value being sent from the alert API.

So for your use-case, you'd need to map this in Alert Manager (since you are on a Free plan with limited functionality to other ways of mapping this in Opsgenie).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Opsgenie

New! Investigate and re-deploy stable deployments from the Incident Investigation view in Opsgenie

We’re excited to announce the latest enhancement to Opsgenie’s Incident Investigation view. Now when an incident occurs users can select the previous stable deployment, and begin the redeployment pro...

293 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you