How to get the each of the applications usage from a Single API-key in New Relic APM

时间:2018-12-03 13:11:29

标签: newrelic newrelic-platform

Many of my applications are monitoring by using NewRelic APM. I need a REST API to get each applications Usage for all Applications in one API Key.

curl -X GET 'https://api.newrelic.com/v2/usages/{product}.json' \
     -H 'X-Api-Key:{api_key}' -i \
     -G -d 'start_date={start_date}&end_date={end_date}' 

The above API is giving a group of applications usage. But I need, the breakup for each application under the key.

Thanks Siva

1 个答案:

答案 0 :(得分:0)

You should use Insights query API instead of deprecated REST API

If you implemented the REST API for querying subscription usage data prior to July 10, 2018, those usage-related REST APIs are now deprecated. You should use the Insights query API, which requires creating an API key. For more on switching to the new API format, see the transition guide.

Insights query API example:

When you create or edit a query key, you will see a sample cURL query that you can use as a template:

curl -H "Accept: application/json" -H "X-Query-Key: YOUR_QUERY_KEY" \ 
  "https://insights-api.newrelic.com/v1/accounts/YOUR_ACCOUNT_ID/query?nrql=YOUR_QUERY_STRING"