New Relic 경고의 경우 NerdGraph API를 사용하여 경고 알림 채널 을 관리할 수 있습니다.적용된 인텔리전스 알림을 관리하는 방법 은 대상에 대한 NerdGraph 자습서를 참조하세요.
팁 NerdGraph를 시작하는 방법은 NerdGraph 소개를 참조하세요.
알림 채널 받기 notificationChannels
쿼리를 사용하면 계정당 모든 알림 알림 채널 을 페이지로 나눌 수 있습니다.또한 notificationChannel
쿼리를 사용하여 해당 ID로 특정 알림 채널을 가져올 수 있습니다.
팁 특정 비밀 필드(예: 암호 또는 API 키)는 반환된 필드에서 난독화됩니다.
계정의 모든 알림 채널 나열 이 예는 제공된 계정 ID의 모든 알림 채널에 대한 모든 필드를 최대 200페이지까지 반환합니다. 인라인 프래그먼트 를 사용하여 AlertsNotificationChannel
인터페이스를 구현하는 구체적인 유형의 특정 필드를 참조하는 방법에 유의하세요.
account ( id : YOUR_ACCOUNT_ID ) {
... on AlertsXMattersNotificationChannel {
... on AlertsWebhookNotificationChannel {
... on AlertsVictorOpsNotificationChannel {
... on AlertsUserNotificationChannel {
... on AlertsSlackNotificationChannel {
... on AlertsPagerDutyNotificationChannel {
... on AlertsOpsGenieNotificationChannel {
... on AlertsHipChatNotificationChannel {
... on AlertsEmailNotificationChannel {
... on AlertsCampfireNotificationChannel {
커서 페이지 매김으로 알림 채널을 통해 페이지 매김 지정된 계정의 알림 채널 목록이 200개 채널 페이지 제한을 초과하는 경우 페이지 매김 커서를 사용하여 추가 페이지를 검색할 수 있습니다.
커서 페이지 매김을 사용하면 해당 필드가 응답에서 공백을 반환할 때까지 nextCursor
을 사용하여 추가 페이지를 계속 요청합니다. 비어 있는 nextCursor
은 결과 집합의 끝에 도달했음을 나타냅니다.
다음은 예입니다.
account ( id : YOUR_ACCOUNT_ID ) {
위의 코드는 다음과 같은 결과 집합을 반환합니다.
"notificationChannels" : {
"nextCursor" : "Wh4LK9JYzfACVlNkyvf7Rg==:I5VbSEpgx3UWNA5AOVsUPv4=" ,
다음 요청에서 다음과 같이 커서를 제공하고 커서가 비어 있을 때까지 업데이트된 커서를 반환하도록 각 후속 요청을 업데이트합니다.
account ( id : YOUR_ACCOUNT_ID ) {
cursor : "Wh4LK9JYzfACVlNkyvf7Rg==:I5VbSEpgx3UWNA5AOVsUPv4="
id로 특정 알림 채널 찾기 특정 알림 채널의 ID가 있는 경우 API를 사용하여 직접 조회할 수 있습니다. 특정 채널은 AlertsNotificationChannel
인터페이스를 구현하는 구체적인 유형이므로 인라인 프래그먼트 에 대해 ... on
구문을 사용하여 특정 필드를 지정해야 할 수도 있습니다.
이 예에서는 Slack 채널을 검색합니다.
account ( id : YOUR_ACCOUNT_ID ) {
notificationChannel ( id : YOUR_CHANNEL_ID ) {
... on AlertsSlackNotificationChannel {
관련 정책과 함께 알림 채널 나열 이 예에서는 제공된 계정 ID의 모든 알림 채널에 대한 ID, 이름 및 유형과 해당 채널과 연결된 모든 정책 목록을 반환합니다.
account ( id : YOUR_ACCOUNT_ID ) {
알림 채널 만들기 경보 알림 채널을 생성하려면 생성하려는 특정 유형의 알림 채널(예: 이메일, Slack 등)과 이를 구성하는 데 필요한 세부 정보(채널에 따라 다름)를 알아야 합니다. 유형). 알림 채널이 생성되면 하나 이상의 알림 정책 과 연결할 수 있습니다. 일단 연결되면 해당 채널은 조건이 위반될 때 해당 정책으로부터 알림을 받습니다.
주의 기존 알림 채널 유형에 대해 쿼리할 수 있지만 해당 유형의 하위 집합만 생성할 수 있습니다. 특히 사용자 채널 유형에는 편집 가능한 필드가 없으며 Campfire 및 HipChat 채널 유형은 모두 더 이상 사용되지 않습니다.
이메일 알림 채널 만들기 이메일 알림 채널에 대한 돌연변이 생성 예:
alertsNotificationChannelCreate (
accountId : YOUR_ACCOUNT_ID
emails : [ "email@example.com" ]
name : "Some Name <email@example.com>"
... on AlertsEmailNotificationChannel {
OpsGenie 알림 채널 생성 OpsGenie 알림 채널에 대한 돌연변이 생성 예:
alertsNotificationChannelCreate (
accountId : YOUR_ACCOUNT_ID
apiKey : " api-key-from-opsgenie "
name : " OpsGenie notification channel name "
recipients : [ "user@example.com" ]
teams : [ "team1" , "team2" ]
... on AlertsOpsGenieNotificationChannel {
PagerDuty 알림 채널에 대한 돌연변이 생성 예:
alertsNotificationChannelCreate (
accountId : YOUR_ACCOUNT_ID
name : " PagerDuty notification channel name "
apiKey : "api-key-from-pagerduty"
... on AlertsPagerDutyNotificationChannel {
Slack 알림 채널 만들기 Slack 알림 채널에 대한 돌연변이 생성 예:
alertsNotificationChannelCreate (
accountId : YOUR_ACCOUNT_ID
name : " Slack notification channel name "
teamChannel : " # team-channel "
url : "https://hooks.slack.com/services/FAKE/MOREFAKE/IMAGINARYEXAMPLEURLCHUNK"
... on AlertsSlackNotificationChannel {
VictorOps 알림 채널 만들기 VictorOps 알림 채널에 대한 돌연변이 생성 예:
alertsNotificationChannelCreate (
accountId : YOUR_ACCOUNT_ID
key : " example-api-key-from-victorops "
name : " VictorOps notification channel name "
routeKey : "example-route-key"
... on AlertsVictorOpsNotificationChannel {
Webhook 알림 채널 만들기 Webhook 알림 채널에 대한 돌연변이 생성 예:
alertsNotificationChannelCreate (
accountId : YOUR_ACCOUNT_ID
baseUrl : " https://example.com/webhook "
password : " t0t4lly-s3cr3t-p455w0rd "
{ name : "X-Api-Key" , value : "100%-real-api-key" }
{ name : "X-Calling-Service" , value : "New Relic Alerts" }
customPayloadBody : " { \"account_id\": \"$ACCOUNT_ID\", \"account_name\": \"$ACCOUNT_NAME\", \"closed_violations_count_critical\": \"$CLOSED_VIOLATIONS_COUNT_CRITICAL\", \"closed_violations_count_warning\": \"$CLOSED_VIOLATIONS_COUNT_WARNING\", \"condition_description\": \"$DESCRIPTION\", \"condition_family_id\": \"$CONDITION_FAMILY_ID\", \"condition_name\": \"$CONDITION_NAME\", \"current_state\": \"$EVENT_STATE\", \"details\": \"$EVENT_DETAILS\", \"duration\": \"$DURATION\", \"event_type\": \"$EVENT_TYPE\", \"incident_acknowledge_url\": \"$INCIDENT_ACKNOWLEDGE_URL\", \"incident_id\": \"$INCIDENT_ID\", \"incident_url\": \"$INCIDENT_URL\", \"metadata\": \"$METADATA\", \"open_violations_count_critical\": \"$OPEN_VIOLATIONS_COUNT_CRITICAL\", \"open_violations_count_warning\": \"$OPEN_VIOLATIONS_COUNT_WARNING\", \"owner\": \"$EVENT_OWNER\", \"policy_name\": \"$POLICY_NAME\", \"policy_url\": \"$POLICY_URL\", \"runbook_url\": \"$RUNBOOK_URL\", \"severity\": \"$SEVERITY\", \"targets\": \"$TARGETS\", \"timestamp\": \"$TIMESTAMP\", \"timestamp_utc_string\": \"$TIMESTAMP_UTC_STRING\", \"violation_callback_url\": \"$VIOLATION_CALLBACK_URL\", \"violation_chart_url\": \"$VIOLATION_CHART_URL\" } "
name : "Webhook notification channel name"
... on AlertsWebhookNotificationChannel {
xMatters 알림 채널 만들기 xMatters 알림 채널에 대한 돌연변이 생성 예:
alertsNotificationChannelCreate (
accountId : YOUR_ACCOUNT_ID
integrationUrl : " https://company.instance.xmatters.com/api/xm/v < version > /... "
name : "xMatters notification channel name"
... on AlertsXMattersNotificationChannel {
알림 채널 업데이트 경고 알림 채널을 업데이트하려면 변경하려는 특정 알림 채널 유형(예: 이메일, Slack 등)과 이를 구성하는 데 필요한 세부정보(채널에 따라 다름)를 알아야 합니다. 유형). 다른 GraphQL API와 일관되게 채널의 ID 외에 다른 정보를 몰라도 채널의 단일 필드를 업데이트할 수 있습니다.
주의 기존 알림 채널 유형에 대해 쿼리할 수 있지만 해당 유형의 하위 집합만 업데이트할 수 있습니다. 특히 사용자 채널 유형에는 편집 가능한 필드가 없으며 Campfire 및 HipChat 채널 유형은 모두 더 이상 사용되지 않습니다.
이메일 알림 채널 업데이트 이름만 업데이트하는 이메일 알림 채널의 업데이트 변형 예:
alertsNotificationChannelUpdate (
accountId : YOUR_ACCOUNT_ID
notificationChannel : { email : { name : "Updated Name <email@example.com>" } }
... on AlertsEmailNotificationChannel {
OpsGenie 알림 채널 업데이트 이름만 업데이트하는 OpsGenie 알림 채널의 업데이트 변형 예:
alertsNotificationChannelUpdate (
accountId : YOUR_ACCOUNT_ID
notificationChannel : { opsGenie : { name : "OpsGenie updated channel name" } }
... on AlertsOpsGenieNotificationChannel {
이름만 업데이트하는 PagerDuty 알림 채널의 업데이트 변형 예:
alertsNotificationChannelUpdate (
accountId : YOUR_ACCOUNT_ID
pagerDuty : { name : "PagerDuty updated channel name" }
... on AlertsPagerDutyNotificationChannel {
Slack 알림 채널 업데이트 이름만 업데이트하는 Slack 알림 채널의 업데이트 변형 예:
alertsNotificationChannelUpdate (
accountId : YOUR_ACCOUNT_ID
notificationChannel : { slack : { name : "Slack updated channel name" } }
... on AlertsSlackNotificationChannel {
VictorOps 알림 채널 업데이트 이름만 업데이트하는 VictorOps 알림 채널의 업데이트 변형 예:
alertsNotificationChannelUpdate (
accountId : YOUR_ACCOUNT_ID
victorOps : { name : "VictorOps updated channel name" }
... on AlertsVictorOpsNotificationChannel {
Webhook 알림 채널 업데이트 이름만 업데이트하는 Webhook 알림 채널의 업데이트 변형 예:
alertsNotificationChannelUpdate (
accountId : YOUR_ACCOUNT_ID
notificationChannel : { webhook : { name : "Webhook updated channel name" } }
... on AlertsWebhookNotificationChannel {
xMatters 알림 채널 업데이트 이름만 업데이트하는 xMatters 알림 채널의 업데이트 변형 예:
alertsNotificationChannelUpdate (
accountId : YOUR_ACCOUNT_ID
notificationChannel : { xMatters : { name : "xMatters updated channel name" } }
... on AlertsXMattersNotificationChannel {
알림 채널 삭제 알림 채널은 계정 아이디와 채널 아이디로만 삭제할 수 있습니다. 채널을 삭제하면 모든 정책에서 연결이 해제되므로 해당 채널에 더 이상 알림이 전송되지 않습니다.
alertsNotificationChannelDelete (
accountId : YOUR_ACCOUNT_ID
채널을 정책에 연결 경보 알림 채널을 만드는 것만으로는 충분하지 않습니다. 채널이 생성되면 하나 이상의 정책 에 연결해야 합니다. 정책에 연결되면 채널은 해당 정책의 조건이 임계값을 초과할 때 경고 알림을 받을 수 있습니다.
이 예에서는 두 개의 채널을 정책과 연결합니다.
alertsNotificationChannelsAddToPolicy (
accountId : YOUR_ACCOUNT_ID
notificationChannelIds : [ FIRST_CHANNEL_ID , SECOND_CHANNEL_ID ]
정책에서 채널 분리 알림 채널이 그 유용성보다 오래 지속된 경우(예: 폐기된 이메일 목록), 알림 알림을 보내는 정책 (들)에서 해당 채널을 분리할 때가 되었습니다. 이 API 호출은 채널 자체를 그대로 유지하지만 지정된 정책에서 제거합니다.
이 예에서는 정책에서 2개의 채널을 제거하고(다른 채널은 그대로 둠) 해당 2개의 채널 ID가 제거되었다는 확인을 받습니다.
alertsNotificationChannelsRemoveFromPolicy (
accountId : YOUR_ACCOUNT_ID
notificationChannelIds : [ FIRST_CHANNEL_ID , SECOND_CHANNEL_ID ]
팁 정책에서 경고 알림 채널을 제거해도 다른 정책에서 사용 중일 수 있으므로 채널이 삭제 되지 않습니다 . 반면에 채널을 삭제하면 연결된 모든 정책이 해당 채널에 대한 경고 알림 전송을 중지합니다.