Trying to make a backups alert
Asked by Alojz Cuk:

Hello,

What I am trying to do is create an opsgenie alert for backups.

The workflow I have in mind is if a success email comes in, opsgenie ignores.

If a failed job email comes in, open a ticket. This will have the backup job name on it.

When the job succeeds, the success email will come in and close the alert in opsgenie.

The issue im having is how do I make the success email job work with the failed job?

The success email needs to match the job name of the failed job. How would I go about matching the two in order for OpsGenie to know to close the alert?

I have set up the ignore for \[Success\] as jobs will run and complete successfully. I need the success emails to come in to let OpsGenie know to close the alert once the failed job with the same job name comes in.

![opsgenie ignore.png](https://community.atlassian.com/t5/image/serverpage/image-id/162319iBAD9C0548337953D/image-size/large?v=v2&px=999 "opsgenie ignore.png")

I have the create alert here. The alert subject will be \[failed\] %BackupJob% has x failed items. Thats no problem. Might show up as **\[failed\] Infrastructure has 3 failed items** ![opsgennie create.png](https://community.atlassian.com/t5/image/serverpage/image-id/162320i30754625E614C355/image-size/large?v=v2&px=999 "opsgennie create.png")

Now wondering how would I make the close ticket recognise the backup job name with \[success\] in the subject to know that the job has completed successfully and close the ticket.

![opsgenie close.png](https://community.atlassian.com/t5/image/serverpage/image-id/162321iE4CC3B582ACB1A88/image-size/large?v=v2&px=999 "opsgenie close.png")


Answers:
author: Nick H
body: Hi [@Alojz Cuk](/t5/user/viewprofilepage/user-id/4574760) ,

You're somewhat on the right track here, but missing a few parts.

It's important to note that all of the integration's actions are evaluated from top \>\> bottom; so the Ignore action(s) are evaluated first, then the Create Alert action(s), etc.

If you have an Ignore action configured to ignore creating alerts for \[Success\] requests, Opsgenie will always ignore these and the request will never have a chance to close the alert through the integration.

So I think you actually want to remove the Ignore action entirely. You'd also want to change the Create Alert action's filter from Match All Alerts \>\> something similar to the Close Alert action - but one that only creates alerts for when \[Failed\] is in the subject or something.

And finally, edit the Close Alert action to close alerts when \[Success\] is in the subject or being parsed in the payload. That entire configuration might look something like this:

![emailcomm1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/162440i7F6CB05A2BFEFC8E/image-size/large?v=v2&px=999 "emailcomm1.jpg")![emailcomm2.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/162439i63F4E9BCC159C07B/image-size/large?v=v2&px=999 "emailcomm2.jpg")

Note as well in both my screenshots the alias field highlighted. The alias is the unique identifier of an alert, and what the integration uses to close an alert if there is already an open existing alert in Opsgenie. You would need to configure this in all your actions, and it should be consistent with both the create and close request. Otherwise Opsgenie won't know which alert to close.

Hope this helps! Let us know if you have any other questions, concerns, etc.

comments: author: Alojz Cuk
body: That worked! thanks SOOOO MUCH!