• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

問題を作成する

合成モニタリングデータにカスタム属性を追加する

New Relicの$util.insightsは、合成モニタリングから報告されたイベントを設定および操作するためのツールのセットです。

カスタムデータを、プレフィックスcustomのカスタム属性としてSyntheticCheckイベントに追加できます。これらの属性は、イベントのデフォルト属性に追加されます。

互換性

この機能は、 モニターバージョン0.2.0以降で使用できます。

関数

働き

戻り値

$util.insights.set(key: string, value: ?)

キーと値のペアを設定します。

空所

$util.insights.get(key: string)

指定されたキーの値を返します。

物体

$util.insights.getKeys()

現在設定されているキーの配列を返します。

物体

$util.insights.has(key: string)

キーがデータに存在する場合はtrueを返します。

ブール値

$util.insights.unset(key: string)

キーと値のペアを削除します。

空所

$util.insights.unsetAll()

すべてのカスタムデータを削除します。

空所

この例では、New RelicのRSSステータスフィードから最新のインシデントを取得し、このイベントの詳細を保存します。

var parseString = require('xml2js').parseString;
// Get the New Relic status RSS feed
$http.get('https://status.newrelic.com/history.rss', function(err, response, body) {
parseString(body, function(err, result){
// Parse the RSS, and get the latest incident
var latestIncident = result.rss.channel[0].item[0];
// Push the incident details to New Relic
$util.insights.set('Incident', latestIncident.title[0]);
$util.insights.set('Description', latestIncident.description[0]);
$util.insights.set('Date', latestIncident.pubDate[0]);
});
});

この例でNewRelicに送信されたインシデントデータを表示するには、次のクエリを使用します。

FROM SyntheticCheck SELECT latest(custom.Date), latest(custom.Incident), latest(custom.Description) WHERE monitorName = "Monitor Name Here"
Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.