• EnglishEspañol日本語한국어Português
  • Inicia sesiónComenzar ahora

Te ofrecemos esta traducción automática para facilitar la lectura.

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.

Crea una propuesta

Agregar atributo personalizado al monitoreo sintético de datos

$util.insights de New Relic es un conjunto de herramientas para configurar y manipular eventos reportados desde el monitoreo sintético.

Puedes agregar datos personalizados como atributo personalizado, con el prefijo custom, al evento SyntheticCheck . Estos atributos se suman al atributo predeterminado del evento.

Compatibilidad

Esta funcionalidad está disponible para las versiones de monitor 0.2.0 o posteriores.

Funciones

Función

Valor de retorno

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

Establece un par principal de valor.

vacío

$util.insights.get(key: string)

Devuelve el valor de la clave proporcionada.

objeto

$util.insights.getKeys()

Devuelve una matriz de claves actualmente configuradas.

objeto

$util.insights.has(key: string)

Devuelve true si la clave existe en los datos.

booleano

$util.insights.unset(key: string)

Elimina el par principal de valor.

vacío

$util.insights.unsetAll()

Elimina todos los datos personalizados.

vacío

Ejemplo

El ejemplo obtiene el último incidente de la fuente de estado RSS de New Relic y guarda los detalles de este evento.

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]);
});
});

Para ver los datos del incidente enviados a New Relic en este ejemplo, utilice esta consulta:

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

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