This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Create custom resource to show "Who is On Call" via OpsGenie API

I'm setting up an OpsGenie trial right now, with SolarWinds Orion integration for on-call management. The feature set looks pretty sweet after having managed scheduling, rotation, and weekly changes manually!

Question: I'm curious if there is a way to create a custom resource on an Orion page that shows the current on-call person[s] via OpsGenie's API.

Parents
  • You can do this by adding a custom html widget in your dashboard and setting that resource up with a javascript to query the API then parse the response into something that looks readable.

    I don't have any code examples of this specifically, but here's something I snagged from google that would give you a starting point

    1. var url ="http://www.rediff.com/rss/inrss.xml";//change url and params
    2. try{
    3.   $.ajax({
    4.   url  :'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q='+ encodeURIComponent(url),
    5.   dataType :'json',
    6.   success  :function(data){
    7. if(data.responseData.feed && data.responseData.feed.entries){
    8.   $.each(data.responseData.feed.entries,function(i, e){
    9. var title = e.title;
    10. var link = e.link;
    11.   list = list +'<li><a href="javascript:display_post(\''+ link +'\')">';
    12.   list = list + title;
    13.   list = list +'</a></li>';
    14. });
    15. }
    16.   list = list +'</ul>';
    17.   document.getElementById("single_feed").innerHTML = list;
    18.   $.ui.loadContent("#single_feed");
    19. }
    20. });
    21. }
    22. catch(e){
    23.   alert(e);
    24. }
  • Since I'm most familiar with PowerShell, I started by testing with that. The following code successfully pulls the "name" (email address) of the on call person. My next step will still be to figure out how to translate this query into JavaScript.

    $key = "REDACTED"
    $header = @{'Authorization' = 'GenieKey ' + $key}
    $scheduleID = "REDACTED"
    $uri = "">api.opsgenie.com/.../on-calls"
    (Invoke-RestMethod -Method GET -Uri $uri -Headers $header).Data.onCallParticipants.Name

    Open to more suggestions, and thanks!

Reply
  • Since I'm most familiar with PowerShell, I started by testing with that. The following code successfully pulls the "name" (email address) of the on call person. My next step will still be to figure out how to translate this query into JavaScript.

    $key = "REDACTED"
    $header = @{'Authorization' = 'GenieKey ' + $key}
    $scheduleID = "REDACTED"
    $uri = "">api.opsgenie.com/.../on-calls"
    (Invoke-RestMethod -Method GET -Uri $uri -Headers $header).Data.onCallParticipants.Name

    Open to more suggestions, and thanks!

Children
No Data