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,556,875
Community Members
 
Community Events
184
Community Groups

Using the OpsGenie Actions API

Hi,
We have an API integration with OpsGenie where our system sends alerts to OpsGenie using the AlertAPI. Now, we would like to create custom actions for that alert (e.g. Open in Grafana), etc. Is there any example on best practices when creating such custom actions? Beyond the raw API documentation we haven't been able to find anything. 

 

Thanks,

Yariv

1 answer

1 accepted

2 votes
Answer accepted
Samir
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 23, 2021

Hi @yariv !

 

The first step is to add the custom action to the alerts (i.e. add the "Grafana" action to your alerts that are created in Opsgenie). This doc goes over how you can do this.

 

There are a few ways you can have this custom action be added to the alert. Since you are using the Alert API to create alerts, you could pass in the "Grafana" action in the Actions field of the payload you are sending to Create Alerts, so that the action would be added to the alert.

Alternatively, you could edit the API integration in Opsgenie, and add the "Grafana" action to the Actions field in the integration, so it will add the "Grafana" actions to alerts created through that integration.

2021-11-23_11-29-20.png

 

Then in terms of how you get that action to trigger something, you could leverage Opsgenie Actions feature to do this. This allows you to trigger a post to a few different "channels" listed there. AWS Systems Manager, Generic Rest Endpoint, AWS SNS, or Opsgenie Edge Connector (OEC).

 

You can then configure scripts in one of those channels that actually make the request to Grafana to open a ticket via API. So the Action you set-up would trigger the script to be executed via one of those channels.

 

If you don't have a set-up in mind already for hosting/running this script, I would recommend going the Opsgenie Edge Connector (OEC) route which is a service you can install somewhere locally that can execute custom scripts, and you can use the Opsgenie Actions feature with an OEC action channel to trigger that script to be executed.

 

Hope this helps!

 

Thanks,

Samir

Hi Samir,
This is very helpful, thanks!
The main caveat for us is that we want to create the actions programmatically and not using the admin UI (hence asking about the Actions API). I want (per alert type) to use the API to define the possible actions for an alert. Then - when the alert is triggered and the user chooses one of the custom actions, I want to 'catch' the actions (using REST / Webhook) and do the 'dispatching' myself. 

In the doc you sent - it only describes how to do this via the UI and I was trying to find a code sample and how to do it via the API...

Hope this clarifies.

Yariv

Samir
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 23, 2021

Hi @yariv ,

 

So you're trying to add the actions to alerts via API? If so - you can just add the actions in the "Actions" field in the payload you are sending to create alerts as shown in the example on the Create Alert API request.2021-11-23_11-51-20.png

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events