New Relic · Arazzo Workflow

New Relic Create Synthetics Alert Condition

Version 1.0.0

Resolve a policy by name and attach a Synthetics monitor condition to it.

1 workflow 1 source API 1 provider
View Spec View on GitHub AnalysisAnalyticsAPMDevOpsInfrastructureMonitoringObservabilityPerformancePlatformArazzoWorkflows

Provider

new-relic

Workflows

create-synthetics-alert-condition
Resolve a policy then attach a Synthetics monitor condition.
Filters policies by exact name, reads the policy id, and creates a Synthetics condition tying a monitor to the policy.
2 steps inputs: conditionName, monitorId, policyName, runbookUrl outputs: conditionId, policyId
1
findPolicy
getAlertsPolicies
Resolve the alert policy by exact name and capture the policy id used to scope the Synthetics condition.
2
createSyntheticsCondition
postAlertsSyntheticsConditionsPoliciesPolicyId
Create a Synthetics condition on the resolved policy that fires when the named monitor fails.

Source API Descriptions

Arazzo Workflow Specification

new-relic-create-synthetics-alert-condition-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: New Relic Create Synthetics Alert Condition
  summary: Resolve a policy by name and attach a Synthetics monitor condition to it.
  description: >-
    Wires Synthetics monitoring into alerting. The workflow resolves an alert
    policy by name, captures the policy id, and creates a Synthetics condition on
    that policy that fires when a given Synthetics monitor fails. Every step
    spells out its request inline so the flow can be read and executed without
    opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: newRelicApi
  url: ../openapi/new-relic-openapi.yml
  type: openapi
workflows:
- workflowId: create-synthetics-alert-condition
  summary: Resolve a policy then attach a Synthetics monitor condition.
  description: >-
    Filters policies by exact name, reads the policy id, and creates a Synthetics
    condition tying a monitor to the policy.
  inputs:
    type: object
    required:
    - policyName
    - conditionName
    - monitorId
    properties:
      policyName:
        type: string
        description: The exact name of the alert policy to attach the condition to.
      conditionName:
        type: string
        description: A title for the Synthetics alert condition.
      monitorId:
        type: string
        description: The id of the Synthetics monitor the condition watches.
      runbookUrl:
        type: string
        description: Runbook URL to display in notifications.
  steps:
  - stepId: findPolicy
    description: >-
      Resolve the alert policy by exact name and capture the policy id used to
      scope the Synthetics condition.
    operationId: getAlertsPolicies
    parameters:
    - name: filter[name]
      in: query
      value: $inputs.policyName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      policyId: $response.body#/policy/id
  - stepId: createSyntheticsCondition
    description: >-
      Create a Synthetics condition on the resolved policy that fires when the
      named monitor fails.
    operationId: postAlertsSyntheticsConditionsPoliciesPolicyId
    parameters:
    - name: policy_id
      in: path
      value: $steps.findPolicy.outputs.policyId
    requestBody:
      contentType: application/json
      payload:
        synthetics_condition:
          name: $inputs.conditionName
          monitor_id: $inputs.monitorId
          runbook_url: $inputs.runbookUrl
          enabled: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      conditionId: $response.body#/synthetics_condition/id
  outputs:
    policyId: $steps.findPolicy.outputs.policyId
    conditionId: $steps.createSyntheticsCondition.outputs.conditionId