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

Duplicate tickets for same alerts are created in Jira

Awais Ali March 5, 2020

I have recently integrated opsgenie to Jira integration to get the tickets for alerts in opsgenie. But the issue is there is a lot of noise since there are same alerts again and again and similarly tickets are generated for the same alerts. There should be one ticket for the same alerts and not duplicates. Any idea on how can that be done in opsgenie or Jira side?

3 answers

1 accepted

0 votes
Answer accepted
Awais Ali April 9, 2020

I did this through Webhook and AWS Lambda. So how it works is it posts to REST API endpoint which is AWS Lambda and there is a Python script in AWS lambda which processes the Opsgenie request and searches the Jira with some parameters. I will post a link to the script and describe its functionality in a day or two.

The script finds an issue, if it does not get one it makes one and if it finds one it adds the alert link to the comments section of an already existing ticket

0 votes
Awais Ali April 14, 2020

Hey @Mamta Kalwani here you go, feel free to improve if you want to. Thanks

OG_JIRA 

0 votes
Andrew Laden
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.
March 6, 2020

The key to this is you want to "de-duplicate" the alert in opsgenie, so that only one opsgenie alert is created.

opsgenie uses the "alias" field to determine if two alerts are for the same event. If they have the same alias, and there is an open alerts for the alias, a new one will not be created.

So what you want to do is see what the alias field is set to currently, and modify it to allow it to be the same for the same alerts.

Exactly how to do this is very dependent on the opsgenie integration and how the alerts are being created, so I cant give you specifics.

However, Opsgenie support is VERY helpful at helping you to create the right rules. I'd suggest reaching out to them (even via the chatbox on thier site) and asking for thier assistance in building the alias.

Awais Ali March 6, 2020

Hey @Andrew Laden

Thanks for the reply. The issue is that I am talking about the Jira side. I understand about the Alias concept that opsgenie uses. The use case is that if you get an alert a ticket is created in opsgenie. Now after some time the alert gets closed and then opens again after lets say X hours. The ticket on the Jira for that alert is already there and it again creates a new one since its a new alert right. 

So I wanted to see that if an issue exists in Jira -- for an alert lets say ABC no matter how many times the alert ABC flaps -- there should be no duplicate tickets in Jira for the alert ABC if it comes lets say 4 times a day.

I hope I made it clear. Thank You !!

Andrew Laden
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.
March 6, 2020

Thats a little harder. The general model is 1 jira issue to 1 opsgenie alert. If you want a model of many opsgenie alerts to 1 jira issue, you are going to have to do that yourself.

Are you using OEC to generate the jira issues from opsgenie? or are you using the native integration. If you are using OEC, you could theoretically write some validation code in that could search jira for an open issue matching your parameters and if found change to a comment operation instead of a create, but its going to take some work to get that right.

Awais Ali March 6, 2020

Yeah, that's what I thought as well. I am currently using native integration. I guess I will have to switch to OEC and write a script to call Jira API and search for the issues and if that exists then there is no need to make another ticket.

What are your thoughts on https://confluence.atlassian.com/adminjiraserver073/creating-issues-and-comments-from-email-861253784.html?_ga=2.202354585.924284190.1583141218-1364091263.1530101294

Do you think this could be useful?

Andrew Laden
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.
March 6, 2020

Not really. I suppose you are thinking of having the email from opsgenie create the ticket instead of the integration? 

You would actually make your situation worse. When an email comes in, jira tries to figure out if it should comment on an existing ticket, or open a new one. There are a few ways it tries. 

1: Looks for an jira issue key in the subject of the email

2: looks for "in-reply-to" or "in-response-to" headers, and tries to match up to a previous email.

Neither of these will match, so every mail from opsgenie will create a new issue. 

The built in jira email handler isnt very configurable.

If you have a add on email handlers (JEMH for example) you could write some custom handling to try to match a mail up to an existing issue. Would probably be harder them the OEC solution.

Awais Ali April 9, 2020

Hey, @Andrew Laden I did this through Webhook and AWS Lambda. So how it works is it posts to REST API endpoint which is AWS Lambda and there is a Python script in AWS lambda which processes the Opsgenie request and searches the Jira with some parameters. I will post a link to the script and describe its functionality in a day or two.

The script finds an issue, if it does not get one it makes one and if it finds one it adds the alert link to the comments section of an already existing ticket. 

Like Andrew Laden likes this
Mamta Kalwani April 14, 2020

Hi @Awais Ali ,

I'd be interested in this script. 

Thanks,

Mamta

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events