Is there a better way to display alerts and alert policies using Nerdpacks?

I am currently working on a Nerdpack that will help us more intelligently investigate alerts (particularly with NRQL based alerts) and I’m trying to find the best way to display any ongoing/previous incidents. I’m able to pull this information from the New Relic API:

function getAPMalerts() {
    let xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {

        //Check if request is completed
        if (xhr.readyState == XMLHttpRequest.DONE) {
            //Log return violations to console

    // Set the request URL and request method"GET", "");

    // Set the `Content-Type` Request header
    xhr.setRequestHeader("X-Api-Key", "");

    // Send the requst with Data
    return xhr.response;

But I’m finding it just a little bit unwieldly… I looked at entities and graphql but there didn’t seem to be existing features that would allow for the display of alert information (like incidents, policies, etc). I tried looking the graphql explorer ( and it seems like it lets you update alerts with mutations but it didn’t look like it just provide that information. I also didn’t see anything for “entities” that listed alerts/policies.

I am still new at this so forgive me if this information is obviously documented somewhere, I can’t seem to find it though. Would it make more sense to try and get this alert information into insights?

Hi @Michael.Sleep

Couple of resources for you…

First, a colleague (@kpeet) has created an ‘Alert Violation Command Center’ Nerdpack. You can see that here:

The code is all there in Github, so if that doesn’t get you what you need, then you can at least take inspiration from how Keagan has implemented that.

Secondly, @philweber wrote about getting alert data into Insights, see that here:

From then you can run NRQL queries within your nerdpack.