【问题标题】:How to get the each of the applications usage from a Single API-key in New Relic APM如何从 New Relic APM 中的单个 API 密钥获取每个应用程序的使用情况
【发布时间】:2018-12-03 13:11:28
【问题描述】:

我的许多应用程序都使用 NewRelic APM 进行监控。我需要一个 REST API 来获取一个 API 密钥中所有应用程序的每个应用程序的使用情况。

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}' 

上面的 API 给出了一组应用程序的使用情况。但我需要,分解键下的每个应用程序。

谢谢 湿婆

【问题讨论】:

    标签: newrelic newrelic-platform


    【解决方案1】:

    您应该使用Insights query API 而不是deprecated REST API

    如果您在 2018 年 7 月 10 日之前实施了用于查询订阅使用数据的 REST API,那么这些与使用相关的 REST API 现在已被弃用。您应该使用需要创建 API 密钥的 Insights 查询 API。有关切换到新 API 格式的更多信息,请参阅转换指南。

    Insights 查询 API 示例:

    当您创建或编辑查询键时,您将看到一个可用作模板的示例 cURL 查询:

    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"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-16
      • 1970-01-01
      • 1970-01-01
      • 2013-08-20
      • 2019-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多