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

문제 신고

NerdGraph 튜토리얼: NRQL 상태 경고

NerdGraph API를 사용하여 경고 조건을 관리할 수 있습니다.

NerdGraph 및 NerdGraph 탐색기를 시작하는 데 도움이 필요하면 NerdGraph 소개 를 참조하세요.

NRQL 조건을 만드는 단계

이 단계를 따르세요:

  1. 생성할 조건 유형을 결정합니다( NRQL 조건 임계값 유형 참조).

  2. 다음 중 하나를 수행하여 관련 policyID 을(를) 찾으십시오.

  3. NRQL 조건 유형 및 관련 값에 대한 적절한 변형을 제공하십시오.

NerdGraph GraphiQL 탐색기는 NerdGraph NRQL Conditions API의 필드별 특성에 대한 최신 문서를 찾을 수 있는 가장 좋은 곳입니다. 예를 들어 " valueFunction 필드는 무엇을 허용합니까?"와 같은 질문입니다. 인라인 NerdGraph 문서로 가장 잘 답할 수 있습니다.

NRQL 정적 조건

다음은 정적 조건을 만드는 예입니다.

mutation {
alertsNrqlConditionStaticCreate(
accountId: YOUR_ACCOUNT_ID
policyId: YOUR_POLICY_ID
condition: {
name: "Low Host Count - Catastrophic"
enabled: true
nrql: {
query: "SELECT uniqueCount(host) FROM Transaction WHERE appName='my-app-name'"
}
signal: {
aggregationWindow: 60
aggregationMethod: EVENT_FLOW
aggregationDelay: 120
}
terms: {
threshold: 2
thresholdOccurrences: AT_LEAST_ONCE
thresholdDuration: 600
operator: BELOW
priority: CRITICAL
}
valueFunction: SINGLE_VALUE
violationTimeLimitSeconds: 86400
}
) {
id
name
}
}

NRQL 기준 조건

다음은 기준 조건을 만드는 예입니다.

mutation {
alertsNrqlConditionBaselineCreate(
accountId: YOUR_ACCOUNT_ID
policyId: YOUR_POLICY_ID
condition: {
name: "Baseline Condition"
enabled: true
baselineDirection: UPPER_ONLY
nrql: { query: "SELECT average(duration) FROM Transaction" }
signal: {
aggregationWindow: 60
aggregationMethod: EVENT_FLOW
aggregationDelay: 120
}
terms: {
threshold: 13
thresholdDuration: 180
thresholdOccurrences: ALL
operator: ABOVE
priority: CRITICAL
}
violationTimeLimitSeconds: 86400
}
) {
id
name
baselineDirection
}
}

조건 업데이트

다음을 완료:

  1. 다음과 같이 nrqlConditionsSearch 쿼리에서 유형 필드를 요청하여 기존 조건의 유형을 결정합니다.

    {
    actor {
    account(id: YOUR_ACCOUNT_ID) {
    alerts {
    nrqlConditionsSearch {
    nrqlConditions {
    id
    type
    }
    }
    }
    }
    }
    }

    반환된 type 은 업데이트 변형에 사용하는 것입니다. 예를 들어, 반환된 유형이 STATIC 이면 alertsNrqlConditionStaticUpdate 를 사용합니다. 반환된 유형이 BASELINE 이면 alertsNrqlConditionBaselineUpdate 를 사용합니다.

  2. 관련 조건 유형 변형에 조건의 id 를 제공합니다. 관련 유형의 조건만 업데이트할 수 있습니다.

업데이트하려는 필드에 대해서만 업데이트 변형을 제공하십시오. 업데이트에서 제공하지 않은 필드는 건드리지 않습니다.

돌연변이 업데이트

업데이트에서 제공한 필드만 변경됩니다. 다음 예에서 baselineDirection 은 변경되지 않은 상태로 반환되지만 name 은 업데이트됩니다.

mutation {
alertsNrqlConditionBaselineUpdate(
id: YOUR_CONDITION_ID
accountId: YOUR_ACCOUNT_ID
condition: { name: "Your updated name" }
) {
id
name
baselineDirection
}
}

NRQL 조건 나열 및 필터링

NRQL 조건을 나열하거나 필터링하려면 NerdGraph에서 nrqlConditionsSearch 쿼리를 사용하세요.

단일 NRQL 조건 쿼리

NRQL 조건 API를 사용하여 단일 조건을 쿼리할 수 있습니다. 경고 네임스페이스에서 nrqlCondition 쿼리를 실행합니다.

nrqlConditionSearch 쿼리의 유형별 필드와 유사하게 이러한 인라인 조각을 사용하여 NRQL 조건 유형으로 제한된 필드를 요청할 수도 있습니다.

{
actor {
account(id: YOUR_ACCOUNT_ID) {
alerts {
nrqlCondition(id: YOUR_CONDITION_ID) {
id
name
... on AlertsNrqlStaticCondition {
valueFunction
}
}
}
}
}
}

설명 업데이트

이것은 NRQL 경고 조건에 대한 설명 을 만드는 절차를 안내합니다.

  1. 정책에 대한 모든 조건 가져오기:

    {
    actor {
    account(id: YOUR_ACCOUNT_ID) {
    alerts {
    nrqlConditionsSearch(searchCriteria: { policyId: YOUR_POLICY_ID }) {
    nrqlConditions {
    id
    name
    description
    enabled
    nrql {
    query
    }
    signal {
    aggregationWindow
    aggregationMethod
    aggregationDelay
    aggregationTimer
    }
    policyId
    runbookUrl
    terms {
    operator
    thresholdDuration
    threshold
    priority
    thresholdOccurrences
    }
    type
    violationTimeLimitSeconds
    }
    }
    }
    }
    }
    }
  2. 단일 조건에 대한 세부정보 가져오기:

    {
    actor {
    account(id: YOUR_ACCOUNT_ID) {
    alerts {
    nrqlCondition(id: "YOUR_CONDITION_ID") {
    description
    id
    enabled
    name
    nrql {
    query
    }
    signal {
    aggregationWindow
    aggregationMethod
    aggregationDelay
    aggregationTimer
    }
    policyId
    runbookUrl
    terms {
    operator
    priority
    threshold
    thresholdDuration
    thresholdOccurrences
    }
    type
    violationTimeLimitSeconds
    }
    }
    }
    }
    }
  3. 설명으로 돌연변이를 만듭니다.

    다음은 빈 돌연변이 템플릿입니다.

    mutation {
    alertsNrqlConditionStaticUpdate(
    accountId: YOUR_ACCOUNT_ID
    id: "YOUR_CONDITION_ID"
    condition: { description: "" }
    ) {
    description
    }
    }

    다음은 예제 설명이 포함된 예제 돌연변이입니다.

    mutation {
    alertsNrqlConditionStaticUpdate(
    accountId: 123456
    id: "123456"
    condition: {
    description: "timestamp : {{timestamp}} \n accountId : {{accountId}} \n type : {{type}} \n event : {{event}} \n description : {{description}} \n policyId : {{policyId}} \n policyName: {{policyName}} \n conditionName : {{conditionName}} \n conditionId : {{conditionId}} \n product : {{product}} \n conditionType : {{conditionType}} \n RunbookUrl : {{runbookUrl}} \n nrqlQuery : {{nrqlQuery}} \n nrqlEventType : {{nrqlEventType}} \n targetID : {{targetId}} \n targetName : {{targetName}} \n commandLine : {{tag.commandLine}} \n entityGuid : {{tag.entityGuid}} \n entityName : {{tag.entityName}} \n fullHostname : {{tag.fullHostname}} \n instanceType : {{tag.instanceType}} \n processDisplayName : {{tag.processDisplayName}}"
    }
    ) {
    description
    }
    }

조건 삭제

alertsConditionDelete 변형을 사용하여 모든 유형의 조건을 삭제할 수 있습니다. 삭제 변형에 대해서만 id 필드를 요청할 수 있습니다. 예를 들어:

mutation {
alertsConditionDelete(accountId: YOUR_ACCOUNT_ID, id: YOUR_CONDITION_ID) {
id
}
}
Copyright © 2024 New Relic Inc.

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