0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

New Relic InsightsのダッシュボードをREST APIから見たい

Posted at

TL;DR

  • New Relic InsightでダッシュボードをREST APIから使うには、Admin user API Keyが必要
  • New Relic REST API Explorerに使いたいAPIと必要なパラメーターを入力すると、curlコマンドを作成してくれるので利用するとよい

やりたいこと

New Relic Insightsのダッシュボードの定義を取得したり、定義からダッシュボードを作成するのにコードなどで表現できるといいなぁと思いまして。

Insights Dashboard APIを使うと良いようです。

で、ドキュメントから利用までの流れを掴むのにややてこずったのでメモとして書いておきます。

New Relic Admin API Keyの入手

Insights Dashboard APIを使用するには、Admin API Keyが必要です。REST API Keyではありません。

New RelicのWeb UIのヘッダーから自分のアイコンをクリックして、Account settingsIntegrationsAPI Keyを選択します。

以下のような画面が表示されます。

image.png

下の表になっているところに、Admin's API Keyが表示されるのですが、最初はなにもないので、矢印のアイコンをクリックして作成します(赤で囲っている部分です)

作成済みであれば、Show keyをクリックして表示させて、Admin API Keyをコピーするなりします。

Insights Dashboard APIにアクセスする

続いて、New Relic REST API Explorerにアクセスして、APIの定義や呼び出し方を確認します。

image.png

左上部に、現在ログインしているアカウントのキーを選ぶようにすれば、Admin API Key(REST API Keyも選べます)が補完されるので便利です。

次に、左のメニューから利用したいAPIを選びます。今回はDashboardsを。

image.png

APIごとに必要なパラメーターを入力すると、curlコマンドを作成してくれます。

image.png

あとは、このコマンドを使ってREST APIを使いましょう。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?