cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

OpsGenie Who is Oncall

Who is Oncall status. version 1.2 Author: Chris O'Rourke with Help from Josh Lovett, Adam Abell, and Thwack.

Here's a quick and clean method to display OpsGenie's Who is Oncall in your team. 

Quick 10 minutes to get up and running:

  1. Add a new external node pointing at app.opsgenie.com
  2. Install the OpsGenie Template.
  3. Point it at the external node you just created
  4. Edit the Powershell script to add your opsgenie API key
  5. Edit the Powershell script to filter which oncall schedules you want displayed
  6. Run the test of the script to generate your list of schedules.
    1. (Optional) edit the field names for the schedules listed.
  7. Click submit.
  8. Head over to your favorite dashboard view (or wherever you'd like the data displayed).
  9. Edit settings
  10. Add custom HTML widget
    1. Paste the following into it and hit submit:
      1. <div id="oncall_table" class="sw-rpt-tbl-frame">
        <script>

        //OpsGenie Oncall Table Generator 0.9 written by Chris O'Rourke April 27th, 2020.

        var swql="SELECT de.ColumnLabel, de.StringData FROM Orion.APM.DynamicEvidence AS de JOIN Orion.apm.CurrentComponentStatus AS ccs ON ccs.ComponentStatusID = de.ComponentStatusID WHERE ccs.ComponentID = 2120 AND de.StringData IS NOT NULL"

        var params = JSON.stringify({
        query: swql,
        parameters: {
        }
        });

        $.ajax({
        type: 'POST',
        url: '/Orion/Services/Information.asmx/QueryWithParameters',
        data: params,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(response) {
        //console.log(response.d.Rows);

        //Initial Table and Headers
        var oncallTable = "<table class='sw-custom-query-table NeedsZebraStripes' style='table-layout: fixed; width: 100%;' cellpadding='2' cellspacing='0'>";
        oncallTable += "<thead><tr class='HeaderRow'>";
        oncallTable += "<th class='ReportHeader' style='font-weight: bold; font-size: 12px; text-align: left;'>Team</th>";
        oncallTable += "<th class='ReportHeader' style='font-weight: bold; font-size: 12px; text-align: left;'>Oncall Resource</th>";
        oncallTable += "<th class='ReportHeader' style='font-weight: bold; font-size: 12px; text-align: left;'>Contact</th>";
        oncallTable += "</tr></thead>";

        //Add Resources to Table
        for(var i=0; i < response.d.Rows.length; i++){
        oncallTable += "<tr>";

        for(var j=0; j < response.d.Rows[i].length; j++) {
        if (response.d.Rows[i][j].indexOf("@") == -1) {
        oncallTable += "<td>" + response.d.Rows[i][j] + "</td>";
        } else {
        //Massage email into First Last name (expects single user oncall)
        var name = '' + response.d.Rows[i][j];
        name = name.split("@");
        name = name[0].split(".");
        name[1] = name[1].replace(/[0-9]/g, '');
        //console.log(name);

        //Render mailto
        oncallTable += "<td style='text-transform: capitalize;'>";
        oncallTable += "<a href='mailto:" + response.d.Rows[i][j] + "'>" + name[0] + " " + name[1] + "</a>";
        oncallTable += "</td>";

        //Render skype
        oncallTable += "<td style='text-transform: capitalize;'>";
        oncallTable += "<a href='im:sip:" + response.d.Rows[i][j] + "'>" + "<img src='/Orion/phpimgs/lync-icon.png'>" + "</a>";
        oncallTable += "</td>";
        }
        }

        oncallTable += "</tr>";
        }


        //Table Close
        oncallTable += "</table>";

        //Grab Element from DOM and Write
        var table = document.getElementById('oncall_table');
        table.innerHTML = oncallTable;
        }
        })
        </script>
        </div>

Snag_4364b944.png

Currently it converts the email address (assuming first.last@domain) into a separate First and Last name and then makes the displayed name a mailto link. It also adds a direct Lync (Skype for Business) link for easier contact.

On deck for next release will be direct Slack DM function as well as Teams too.

Labels (1)
Attachments
Version history
Revision #:
5 of 5
Last update:
‎05-20-2020 08:48 AM
Updated by: