• 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.

문제 신고

인시던트 이벤트 REST API

Event API 를 사용하여 맞춤형 적용 인텔리전스 사건 이벤트를 New Relic에 보고할 수 있습니다.

API는 비동기 엔드포인트입니다. 즉, 낮은 응답 지연 시간으로 많은 양의 POSTS를 안정적으로 보낼 수 있습니다.

API 사용: 개요

인시던트 이벤트 API를 통해 New Relic에 커스텀 인시던트 이벤트를 보내는 일반적인 프로세스는 다음과 같습니다.

  1. 생성

    데이터를 보고하려는 계정에 대해.

  2. 사용자 정의 속성 생성을 시작하기 전에 Event API의 제한 및 제한된 문자 를 검토하십시오.

  3. JSON 형식 지침 을 따르는 사건 이벤트에 대한 JSON을 생성합니다.

  4. POST 요청에서 curl을 사용하여 압축된 JSON 페이로드(예: gzip 또는 deflate)를 HTTPS 끝점에 제출합니다.

사건 이벤트 데이터를 New Relic에 보내기 시작했으면 구문 분석 오류에 대한 알림을 받도록 NRQL 경고 조건 을 설정하는 것이 좋습니다.

예제 JSON

JSON 페이로드는 이 예와 비슷할 수 있습니다.

[
{
"eventType": "NrAiIncidentExternal",
"title": "Test",
"description": "The latency is above threshold of 500000 MS",
"state": "trigger",
"source": "luna",
"entityName": "testEntity",
"entity.guid": "testEntity123",
"aggregationTag.serviceId": 5,
"aggregationTag.environment": "testing",
"aggregationTag.errorId": 10543,
"tag.stackTrace": "some stack trace...",
"version": 1
}
]

eventType 필드는 NrAiIncidentExternal 을 사용해야 합니다.

명령줄에서 인시던트 이벤트 보내기

다음은 curl을 사용하여 JSON 페이로드를 보내는 방법의 예입니다.

bash
$
gzip -c example_incidents.json | curl --data-binary @- -X POST -H "Content-Type: application/json" -H "Api-Key: YOUR_LICENSE_KEY" -H "Content-Encoding: gzip"
$
https://insights-collector.newrelic.com/v1/accounts/YOUR_ACCOUNT/events
Response
{"success":true, "uuid":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}%

인시던트 이벤트 데이터를 성공적으로 전송하면 적용된 인텔리전스 UI에서 또는 해당 데이터를 쿼리 하여 볼 수 있습니다.

인시던트 이벤트에 대한 쿼리 예

Nerdgraph API 를 사용하여 데이터를 쿼리할 수 있습니다.

다음은 NerdGraph 쿼리와 그 결과의 예입니다.

{
actor {
account(id: YOUR_ACCOUNT_ID) {
nrql(query: "SELECT * FROM NrAiInternalIncident since 3 days ago") {
results
}
}
}
}
"results": [
{
"timestamp": 1641910123824,
"totalViolations": 3,
"violationIds": "[416e2e55069764086ad83e97a1160be0cb4c545b7950522f7c86baaa2a11b9b6]",
"triggeredAt": 1641909163980,
"entitiesData.ids": "testEntity123",
"entitiesData.types": "unknown",
"labelsHash": "91f938318e899dcd62965e2724548f4844f2898f3cf1c5411397ecc0eec87fc1",
"annotations.description": "[\"The latency is above threshold of 500000 MS\"]",
"labels.originalAccountIds": "YOUR_ACCOUNT_ID",
"entitiesData.names": "testEntity",
"entitiesData.entities": "{\"id\":\"testEntity123\",\"name\":\"testEntity\",\"type\":\"unknown\"}",
"priority": "HIGH",
"labels.serviceId": "5",
"labels.environment": "testing",
"closedAt": "",
"updatedAt": 1641910123824,
"annotations.title": "[\"Test\",\"Test2222\",\"Test3\"]",
"nrAccountId": YOUR_ACCOUNT_ID,
"accumulations": "{\"source\":[\"rest\"],\"origin\":[\"luna\"],\"entity_guid\":[\"testEntity123\"],\"tag.stackTrace\":[\"some stack trace...\"]}",
"labels.accountIds": "YOUR_ACCOUNT_ID",
"createdAt": 1641909163997,
"priority.order": 2,
"labels.aggregationKeys": "416e2e55069764086ad83e97a1160be0cb4c545b7950522f7c86baaa2a11b9b6",
"accumulations.origins": "[\"luna\"]",
"accumulations.entity_guid": "[\"testEntity123\"]",
"incidentId": "a06ffb92-2f7e-473b-953f-151ff4777cb0",
"labels.errorId": "10543",
"dataMLModules": "{}",
"triggerEvent": "VIOLATION_ADDED",
"accumulations.tag.stackTrace": "[\"some stack trace...\"]",
"isIint": false,
"accumulations.sources": "[\"rest\"]",
"entitiesData": "{\"name\":\"testEntity\",\"id\":\"testEntity123\",\"type\":\"unknown\",\"entities\":\"{\\\"id\\\":\\\"testEntity123\\\",\\\"name\\\":\\\"testEntity\\\",\\\"type\\\":\\\"unknown\\\"}\"}",
"annotations": "{\"title\":[\"Test\",\"Test2222\",\"Test3\"],\"description\":[\"The latency is above threshold of 500000 MS\"]}",
"labels": "{\"accountId\":\"XXXXXXX\",\"originalAccountId\":\"XXXXXXX\",\"entityId\":\"testEntity123\",\"entityName\":\"testEntity\",\"entityType\":\"unknown\",\"aggregationKey\":\"416e2e55069764086ad83e97a1160be0cb4c545b7950522f7c86baaa2a11b9b6\",\"serviceId\":\"5\",\"errorId\":\"10543\",\"environment\":\"testing\"}",
"state": "CREATED"
}
]

인시던트 이벤트 API 사양

인시던트 이벤트 API는 이벤트 API의 값 유형을 사용합니다. 이러한 값 유형 및 사용 지침에 대한 설명은 이벤트 API JSON 지침 을 참조하십시오.

설명

aggregationTag.*

문자열 , 숫자 또는 타임스탬프

필수의

aggregationTag 접두사가 붙은 모든 속성은 트리거 이벤트를 함께 집계하는 데 사용됩니다.

즉, 집계 태그가 동일한 두 개의 트리거 이벤트가 동일한 인시던트에 집계됩니다. (이는 그들 사이에 해결 이벤트가 없다고 가정합니다).

인시던트를 해결할 때 해결 이벤트에 동일한 집계 태그가 포함되어야 합니다.

예약된 키워드가 있는 집계 태그는 필터링됩니다. 예를 들어 aggregationTag.priority: 2 이 있는 JSON 페이로드에서 이 키-값 쌍은 다음 예약된 키워드를 사용하는 사건 이벤트에서 생략됩니다.

reserved_key: {"priority", "accountId", "originalAccountId", "policyId", "conditionId", "aggregationKey", "entityType", "entityName", "entityId", "violationUuid", "violationId", "nrIncidentId" }

state

열거형: (trigger, resolve)

필수의

이벤트가 새 인시던트를 트리거해야 하는지 아니면 기존 인시던트를 해결해야 하는지 여부입니다. 인시던트에 대한 업데이트는 트리거를 사용하여 보낼 수도 있습니다.

priority

열거형: (low, medium, high, critical)

인시던트의 우선 순위입니다. 기본값: high.

다른 우선순위가 전송될 때 가장 높은 우선순위가 사용됩니다.

title

필수, state 인 경우 trigger

트리거 이벤트의 제목입니다.

source

필수, state 인 경우 trigger

인시던트의 출처 또는 인시던트를 촉발한 모니터링 시스템(장애가 발생한 엔티티 아님).

description

트리거 이벤트의 설명입니다.

deepLinkUrl

사건과 관련된 페이지에 대한 딥 링크입니다.

runbookUrl

Runbook URL입니다.

externalId

이벤트에 연결할 수 있는 외부 ID입니다.

예를 들어 이 이벤트 수집과 관련된 오류를 쿼리하는 데 사용할 수 있습니다.

entityName

인시던트를 생성한 엔터티의 이름입니다.

entity.guid

인시던트를 생성한 엔터티의 ID입니다.

version

뜨다

현재 형식의 버전입니다.

Copyright © 2024 New Relic Inc.

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