I am performing an audit on our new relic instrumentation and I want to gather a list of all the apps we have in new relic, along with the alert policies set up for the apps, and where those alert policies are sending their alerts.
The output is an excel spreadsheet that looks a little something like this :-
AppName | AppID | Alert Name | Alert Metric Type | Alert Location
Website1 | 1234 | Alert on errors | error_percentage | email@example.com
I have the first 4 columns working by first calling the API at : https://api.newrelic.com/v2/applications.json
That gives me a list of the apps.
I then call alerts entity conditions using the app.Id I got from the above call : https://api.newrelic.com/v2/alerts_entity_conditions/
So that gives me the first 4 columns, but I am struggling to see how I can get the alert policies, and then the email address associated with those alerts.
I can see that I can call alerts_channels.json to get all the alert channels, which contains a list of alert policies for each notification channel. But how can I link the policy ID to the alert entity condition?
The call to alerts_policies.json accepts a policy name, which is what I guess I should be using, but I cant see that returned in any of the calls.