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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,546
Community Members
 
Community Events
185
Community Groups

How to parse Json problem Detail field in opsgenie

serge calderara
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 08, 2021

Dear all,

We are actually testing Dynatrace integration with Opsgenie. For that we use teh Dynatrace webHook v2.

During our test we receive the following sample json inside variable Problem Detail json:

{id=5017950126589695604_1623155880000V2, startTime=1623155880000, endTime=-1, displayName=P-210653, impactLevel=INFRASTRUCTURE, status=OPEN, severityLevel=CUSTOM_ALERT, commentCount=0, tagsOfAffectedEntities=[{context=CONTEXTLESS, key=Retail-preprod}, {context=AZURE, key=Deployed by, value=Azure DevOps}, {context=AZURE, key=Infrastructure Artifact Version, value=1.3.0}], rankedEvents=[{startTime=1623155880000, endTime=-1, entityId=CUSTOM_DEVICE-049862F797750387, entityName=afd-xr-expro-preprod, severityLevel=CUSTOM_ALERT, impactLevel=INFRASTRUCTURE, eventType=CUSTOM_ALERT, status=OPEN, severities=[], isRootCause=false}], rankedImpacts=[{entityId=CUSTOM_DEVICE-049862F797750387, entityName=afd-xr-expro-preprod, severityLevel=CUSTOM_ALERT, impactLevel=INFRASTRUCTURE, eventType=CUSTOM_ALERT}], affectedCounts={INFRASTRUCTURE=1, SERVICE=0, APPLICATION=0, ENVIRONMENT=0}, recoveredCounts={INFRASTRUCTURE=0, SERVICE=0, APPLICATION=0, ENVIRONMENT=0}, hasRootCause=false}

 

from that json field we would like to extract fields value in bold in order to store them in an extra properties as below :

Impacted Level : INFRASTRUCTURE

Entity Name : afd-xr-expro-preprod

What is the way to parse this data using regex ?

Thanks for help

regards

 

2 answers

0 votes
Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 08, 2021

/impactLevel=.*?,/

hopefullly you can work out the rest.

serge calderara
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 08, 2021

hello @Danyal Iqbal , how can I format what you sugest and from where?

I doubt that this will work because in the payload I have 3 different places where the impactLevel is set.

will it return the first one it finds out or all 3 ?

regards

0 votes
Nick H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jun 08, 2021

Hi @serge calderara ,

Based on that payload, you should be able to extract the Impacted Level and Entity Name using some form of string processing: https://support.atlassian.com/opsgenie/docs/string-processing-methods-in-opsgenie-integrations/

I think what you need for both of those would be something like:

Impacted Level: {{ _payload.substringBetween("impactLevel=",",") }}

Entity Name: {{ _payload.substringBetween("entityName=",",") }}

 

You could also consider using some form of regex to extract this data as well: https://support.atlassian.com/opsgenie/docs/regular-expressions-for-improved-alert-filtering/

 

Hope this helps! Let us know whether or not this works, if you run into any other questions / issues, etc.

-Nick

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events