As I was teaching a customer about Insights this week, they had a “lightbulb moment”: “Ooh,” they asked, “can we use Insights to analyze Alerts data? Create a dashboard that shows how many incidents have occurred for each alert policy, and which conditions triggered each incident?” Turns out you can, and it’s surprisingly easy to set up.
In order to set it up, you’ll need the following information from your Insights account:
- An Insert Key for the Insights API
- Your New Relic account ID, which is included in the Insights events API endpoint (
Now that you have the necessary information, create a Webhook notification channel in Alerts. In the Base Url field, enter the Insights events API endpoint. Add a Custom Header named X-Insert-Key, and set its value to your Insights API Insert Key:
Next, customize the JSON payload that Alerts will send to Insights: add an additional field named eventType, and specify what you’d like to call your custom Insights event (I called mine alert):
You may optionally delete or rename attributes (the values to the left of the colons). Save your changes, and associate your new Webhook channel with one or more alert policies.
That’s it! Whenever a condition is violated on one of those policies, Alerts will post the details of the incident to Insights, where you may slice and dice it to your heart’s content.