ダッシュボードの詳細の取得

最終更新日: 18 年 2024 月 XNUMX 日

LogicMonitor REST API v3 を使用して、ダッシュボードの詳細を取得できます。 API リクエストを行う前に、自分自身を認証する必要があります。

ダッシュボードのリストの取得

URI: 取得 /dashboard/dashboards

タイプ説明
fields文字列応答はフィルター処理され、各オブジェクトの指定されたフィールドのみが含まれます。 プロパティのリストをカンマで区切って指定できます。
例– /dashboard/dashboards?fields=id,description
size整数表示する結果の数を示します。 GET リクエストでは最大 1000 件の結果をリクエストできます。このパラメータに値が指定されていない場合、デフォルトでは 50 個のダッシュボードのリストが返されます。
例– /dashboard/dashboards?size=10
offset整数表示された結果をオフセットする結果の数を示します。
例– /dashboard/dashboards?offset=5
filter文字列応答は、演算子と指定された値に従ってフィルタリングされます。 filter=property:value
  • 複数の文字と一致するにはアスタリスク (*) を使用します
  • オブジェクト内の値をフィルターするには、ドット (.) 文字を使用します (例 – custom properties)
  • 複数のフィルターを区切るにはカンマ (,) を使用します。

演算子は次のとおりです。
  • 以上以上 >:
  • 以下 <:
  • 越える >
  • 以下 <
  • 等しいです :
  • 等しくない !:
  • 含まれています ~
  • 含まれていません !~
例– /dashboard/dashboards?filter=groupName~Server Dashboard*

次のNode.jsスクリプトは、アカウントapi.logicmonitor.comのすべてのダッシュボードを要求します。

//Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
//Note: The below is provided for illustration purposes only.
var readlineSync = require('readline-sync');
var accessId = readlineSync.question('Enter your AccessId: ', { hideEchoBack: true });
var accessKey = readlineSync.question('Enter your AccessKey: ', { hideEchoBack: true });
var company = 'api'
 
// Request Details
var httpVerb = "GET";
var epoch = (new Date).getTime();
var resourcePath = "/dashboard/dashboards";
 
// Construct signature
var requestVars = httpVerb + epoch + resourcePath;
var crypto = require("crypto");
var hex = crypto.createHmac("sha256", accessKey).update(requestVars).digest("hex");
var signature = new Buffer(hex).toString('base64');
   
// Construct auth header
var auth = "LMv1 " + accessId + ":" + signature + ":" + epoch;
// Configure request options
var request = require('request');
var options =
    {
      "method" : httpVerb,
            "uri" : "https://" + company + ".logicmonitor.com/santaba/rest" + resourcePath,
            "headers": {
                'ContentType' : 'application/json',
                'Authorization': auth
              },
            "qs": {
                   'fields': 'id,name',
                   'filter': 'name~ip'
                  }
    };
 
// Make request
request(options, function (error, response, body) {
        if (!error && response.statusCode == 200) {
           // Print out the response body
           console.log(body)
         }
     });
Node.js

特定のダッシュボードの詳細の取得

URI: 取得 /dashboard/dashboards/{id}

タイプ説明
id整数(必須の) 詳細を取得するダッシュボードの ID。
templateブーリアンとして設定されている場合 true、次にダッシュボード テンプレートを次のいずれかで返します。 json フォーマットするか返す file。デフォルトでは、次のように設定されています false.
format文字列この形式は次の場合にのみ使用されます。 template として設定されています true。サポートされている形式は次のとおりです json or file。デフォルトの形式は次のとおりです json.
fields文字列応答はフィルター処理され、各オブジェクトの指定されたフィールドのみが含まれます。 プロパティのリストをカンマで区切って指定できます。
例– /dashboard/dashboards/id?fields=name,description

次のNode.jsスクリプトは、アカウントapi.logicmonitor.comのダッシュボード34を要求します。

//Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
//Note: The below is provided for illustration purposes only.
var readlineSync = require('readline-sync');
var accessId = readlineSync.question('Enter your AccessId: ', { hideEchoBack: true });
var accessKey = readlineSync.question('Enter your AccessKey: ', { hideEchoBack: true });
var company = 'api'
 
// Request Details
var httpVerb = "GET";
var epoch = (new Date).getTime();
var resourcePath = "/dashboard/dashboards/34";
 
// Construct signature
var requestVars = httpVerb + epoch + resourcePath;
var crypto = require("crypto");
var hex = crypto.createHmac("sha256", accessKey).update(requestVars).digest("hex");
var signature = new Buffer(hex).toString('base64');
   
// Construct auth header
var auth = "LMv1 " + accessId + ":" + signature + ":" + epoch;
// Configure request options
var request = require('request');
var options =
    {
      "method" : httpVerb,
            "uri" : "https://" + company + ".logicmonitor.com/santaba/rest" + resourcePath,
            "headers": {
                'ContentType' : 'application/json',
                'Authorization': auth
              },
            "qs": {
                   'fields': 'id,name',
                   'filter': 'name~ip'
                  }
    };
 
// Make request
request(options, function (error, response, body) {
        if (!error && response.statusCode == 200) {
           // Print out the response body
           console.log(body)
         }
     });
Node.js

ダッシュボード ID に基づいてウィジェットのリストを取得する

URI: 取得 /dashboard/dashboards/{id}/widgets

クエリパラメータ fieldssizeoffsetfilter を作成するときにも含める必要があります。 GET コール /dashboard/dashboards/{id}/widgets。このセクションの表を参照してください。 ダッシュボードのリストの取得 クエリパラメータの詳細については、

追加パラメータ id に特有のもの GET コール /dashboard/dashboards/{id}/widgets 以下の表で説明されています。

タイプ説明
id整数(必須の) ダッシュボードに固有のウィジェット リストを取得するためのダッシュボードの ID。

記事上で