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

Create an alert policy

|View as Markdown (English)

The action identifier is newrelic.alerts.createPolicy.

Creates a new alert policy. A policy groups related alert conditions and controls how violations create incidents.

The following table describes all available input fields for this action.

Input

Type

Description

Example

accountId

Int

Required. The New Relic account in which to create the policy. Must be a positive integer.

123456

name

String

Required. The name of the policy.

"Production Services"

incidentPreference

String

Required. Determines how incidents are created for violations. One of PER_CONDITION (one issue per condition), PER_CONDITION_AND_TARGET (one issue per condition per signal), or PER_POLICY (one issue per policy).

"PER_CONDITION"

selectors

List

Optional. JQ selectors to extract values from the response.

selectors:
- name: policyId
expression: ".data.alertsPolicyCreate.id"

The following table describes all output fields returned by this action.

Output

Type

Description

success

Boolean

true when the step executed without error.

errorMessage

String

Error message on failure. null on success.

data

Map

NerdGraph response. Use selectors to extract id, name, incidentPreference, accountId, or entityGuid from data.

{
"data": {
"alertsPolicyCreate": {
"id": "2000002",
"name": "Production Services",
"incidentPreference": "PER_CONDITION",
"accountId": 123456,
"entityGuid": "MTIzNDU2fEFJT1BTfE9QVFxfUE9MSUNZfDc4OTA="
}
}
}

The following example creates an alert policy and captures the new policy ID for use in subsequent steps.

Workflow example

name: create_alert_policy
description: Create an alert policy
steps:
- name: createPolicy
type: action
action: newrelic.alerts.createPolicy
version: 1
inputs:
accountId: ${{ .workflowInputs.accountId }}
name: "Production Services"
incidentPreference: "PER_CONDITION"
selectors:
- name: policyId
expression: ".data.alertsPolicyCreate.id"
next: end
Copyright © 2026 New Relic株式会社。

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