How to set up Customer value to opsgenie priority from PRTG
Asked by Isabel Grose:

Hello,

We are trying to set Customer values to Opsgenie priority from the PRTG integration by assigning our own mapped priority values. We are trying to map the priority PRTG is sending over to Opsgenie which comes in the form of stars (\*) but can't seem to work out how to get this to map.

This is an example of what we have attempted which hasn't worked.

priority: '{{ if eq .priority "\*\*\*\*\*"}}P1{{else if eq .priority "\*\*\*\*"}}P2{{else if eq .priority "\*\*\*"}}P3{{else if eq .priority "\*\*"}}}}P4{{else}}P5{{end}}'

Have tried to find similar issues on your forums but haven't found a solution.

Many thanks


Answers:
author: Darryl Lee
body: Hi [@Isabel Grose](/t5/user/viewprofilepage/user-id/4888385) ,

This is Darryl. I am here to help.

Understand that you would like to set up the PRTG integration on your Opsgenie to auto-parse the custom priority levels from the asterisk symbol (\*).

Unfortunately, this is not feasible in the current design.

According to our [official document](https://support.atlassian.com/opsgenie/docs/what-is-the-priority-level-of-integration/), the Priority values that Opsgenie accepts are only limited to this format: **P1** , **P2** , **P3** , **P4,** or **P5.**

That said, using any other indicators will not be working.

Should you have any further inquiries, please feel free to contact [Opsgenie Support](https://support.atlassian.com/opsgenie/) and my colleague will help you from there.

Thanks.

Kind regards,   
Darryl Lee  
Support Engineer, Atlassian

comments: author: Isabel Grose
body: Hi [@Darryl Lee](/t5/user/viewprofilepage/user-id/3680306) ,

thanks for getting back to me.

You've mentioned this isn't feasible in the current design, is this something that might be considered for future changes? PRTG is one of the out of the box integrations associated with Opsgenie and it seems a shame not to have the features available to accommodate alerting prioritisation.

Is there an alternative way to set up priority mapping against PRTG, one that doesn't require setting up each alert individually?

Many thanks


author: Darryl Lee
body: Hi [@Isabel Grose](/t5/user/viewprofilepage/user-id/4888385) ,

Thanks for getting back to us.

I understand how this impacts the operation/integration as the asterisk format is the default format by PRTG.

I have created a feature request, [OPSGENIE-428](https://jira.atlassian.com/browse/OPSGENIE-428), please vote it and set yourself as a Watcher to receive the latest updates.

*** ** * ** ***

As for a workaround, if your Opsgenie subscription is at a Standard or Enterprise, you may follow the concepts below to resolve this.

Alert Fields on Advanced Integration Settings {#toc-hId--556638542}
-------------------------------------------------------------------

Reference Documentation -\>

<https://docs.opsgenie.com/docs/integrations-framework> <https://docs.opsgenie.com/docs/advanced-integration-settings> <https://docs.opsgenie.com/docs/filters> <https://docs.opsgenie.com/docs/draggable-fields> <https://docs.opsgenie.com/docs/priority-field>

Under your integration configurations, while defining a "Create Alert" rule, you can set the priority field:

* as P1, P2, P3, P4, P5,
* as {{priority}},
* or as Custom Value to Opsgenie Priority.

![Screenshot 2022-04-25 at 17.10.33.png](https://community.atlassian.com/t5/image/serverpage/image-id/194470i19E4D9D67969CA7D/image-size/large?v=v2&px=999 "Screenshot 2022-04-25 at 17.10.33.png")  
The first option is simply assigning the set priority to the created alert.

The second option {{priority}}, can have two different outcomes.  
* If the integration sends a priority value and Opsgenie maps it with the known priority values that are P1, P2, P3, P4, or P5, an alert will be created with the sent priority value.

* If the priority sent from the integration does not match with the known priority values (e.g. it is received as CRITICAL), automatically the alert will be generated with P3.

  The third option "Custom Value to Opsgenie Priority" is giving a chance for defining how you want to parse the priority from the payload. The parsed value again should be in the format of P1, P2, P3, P4, or P5.

![Screenshot 2022-04-25 at 17.12.18.png](https://community.atlassian.com/t5/image/serverpage/image-id/194472iFE32989EB44B49C0/image-size/large?v=v2&px=999 "Screenshot 2022-04-25 at 17.12.18.png")

If either of these options does not work in case when the incoming data does not contain the values P1, P2, P3, P4, P5, you can create multiple Create Alert rules, one for each priority levels, as shown below.

![Screenshot 2022-04-25 at 17.13.10.png](https://community.atlassian.com/t5/image/serverpage/image-id/194473i03ABAB0DC08A8889/image-size/large?v=v2&px=999 "Screenshot 2022-04-25 at 17.13.10.png")![Screenshot 2022-04-25 at 17.13.37.png](https://community.atlassian.com/t5/image/serverpage/image-id/194474iC9BBD9A5909778C6/image-size/large?v=v2&px=999 "Screenshot 2022-04-25 at 17.13.37.png")  

Leveraging Alert Policy without any changes on the integration settings {#toc-hId-1930874291}
---------------------------------------------------------------------------------------------

<br />

Reference Documentation

-\> <https://docs.opsgenie.com/docs/team-policies#alert-policy>

-\> <https://docs.opsgenie.com/docs/global-policies#alert-policy>

There are 2 types of Alert Policy, Team-based and Global, here we take Team-based alert policy for example.  
Let's say we expect the alerts created by Icinga2 integration owned by Demo Team which has the string "Host is Down" in the Alert Message to be prioritised as P1-Critical.

On the Create Alert action rule in the Advanced integration page of the Icinga2, we can see the alerts created by this integration will have the field and value:  
"Source": "Icinga2".

![Screenshot 2022-04-25 at 17.15.18.png](https://community.atlassian.com/t5/image/serverpage/image-id/194475i4456404F32335F12/image-size/large?v=v2&px=999 "Screenshot 2022-04-25 at 17.15.18.png")  
So then we can navigate to the Teams \> Demo Team \> Policies, click the button to "Add alert policy" and craft the alert policy like this:

1. Toggle up "Enable policy when created".

2. Configure the conditions filter as

   "Match all conditions below"  

   "Message" \| "Contains" \| "Host is Down"

   "Source" \| "Contains" \| "Icinga2"
3. Select the Priority as "P1-Critical"

![Screenshot 2022-04-25 at 17.17.39.png](https://community.atlassian.com/t5/image/serverpage/image-id/194476i9D1F9A8AE1E86F49/image-size/large?v=v2&px=999 "Screenshot 2022-04-25 at 17.17.39.png")  
After saving it, that's all!  
With the above settings, we can ensure that only the alerts created by this Demo Team's Icinga2 integration matching the conditions filter will be prioritized as P1-Critical.

Please note that all the settings on Opsgenie are case-sensitive.

*** ** * ** ***

Hope this helps.

Kind regards,   
Darryl Lee  
Support Engineer, Atlassian