New Relic allows you use NerdGraph to create step monitors. Step monitors provide codeless, multi-step browser-based monitoring that allows you to configure complex user workflows without writing any code. This tutorial provides examples of how to use the NerdGraph API to automate the creation of step monitors.
Create a step monitor
You can create a step monitor using the syntheticsCreateStepMonitor mutation. This mutation allows you to set up multi-step browser monitoring with a series of predefined actions.
Input parameters
Parameter | Data Type | Is it Required? | Description |
|---|---|---|---|
| Integer | Yes | Your New Relic account ID where the monitor will be created. |
| Array | Yes | Browser(s) that the monitor will use to execute jobs. Supported browsers: |
| Array | Yes | Devices that the monitor will use to execute jobs. Supported devices: |
| Array | Yes | Array of public location identifiers where the monitor will run checks (e.g., |
| String | Yes | The display name for your step monitor. |
| Enum | Yes | How often the monitor runs. Options: |
| String | Yes | The runtime type used by your monitor. |
| String | Yes | The runtime type version used by your monitor. |
| String | Yes | The language used in your monitor. |
| Enum | Yes | The monitor status. Options: |
| Array | Yes | The series of steps the monitor will execute. Each step object contains: |
| Boolean | No | Captures a screenshot during job execution when a failure occurs or a script is executed. |
| Float | No | The monitor's Apdex target in seconds, used to populate SLA reports. Defaults to 7.0 seconds. |
Sample request
mutation { syntheticsCreateStepMonitor( accountId: ACCOUNT_ID monitor: { browsers: [BROWSERS] devices: [DEVICES] locations: { public: ["LOCATION_1", "LOCATION_2"] } name: "MONITOR_NAME" period: PERIOD runtime: { runtimeType: "RUNTIME_TYPE" runtimeTypeVersion: "RUNTIME_TYPE_VERSION" scriptLanguage: "SCRIPT_LANGUAGE" } status: STATUS steps: [ { ordinal: 0, type: NAVIGATE, values: ["MONITORED_URI", "USER_AGENT"] } { ordinal: STEP_NUMBER type: STEP_TYPE values: ["CONDITIONAL_TYPE", "VALUE"] } ] advancedOptions: { enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT } apdexTarget: APDEX_TARGET } ) { errors { description type } }}Sample response
A successful response returns null for errors:
{ "data": { "syntheticsCreateStepMonitor": { "errors": null } }}If there are any issues creating the monitor, the errors array will contain objects with description and type fields explaining what went wrong.
Update a step monitor
You can update an existing step monitor using the syntheticsUpdateStepMonitor mutation. This allows you to modify the configuration of a step monitor that has already been created.
Input parameters
Parameter | Data Type | Is it Required? | Description |
|---|---|---|---|
| String | Yes | The unique entity GUID of the monitor you want to update. |
| Array | No | Browser(s) that the monitor will use to execute jobs. Supported browsers: |
| Array | No | Devices that the monitor will use to execute jobs. Supported devices: |
| Array | No | Array of public location identifiers where the monitor will run checks (e.g., |
| String | No | The updated display name for your step monitor. |
| Enum | No | How often the monitor runs. Options: |
| String | No | The runtime type used by your monitor. |
| String | No | The runtime type version used by your monitor. |
| String | No | The language used in your monitor. |
| Enum | No | The monitor status. Options: |
| Array | No | The series of steps the monitor will execute. Each step object contains: |
| Boolean | No | Captures a screenshot during job execution when a failure occurs or a script is executed. |
| Float | No | The monitor's Apdex target in seconds, used to populate SLA reports. Defaults to 7.0 seconds. |
Sample request
mutation { syntheticsUpdateStepMonitor( guid: ENTITY_GUID monitor: { browsers: [BROWSERS] devices: [DEVICES] locations: { public: ["LOCATION_1", "LOCATION_2"] } name: "MONITOR_NAME" period: PERIOD runtime: { runtimeType: "RUNTIME_TYPE" runtimeTypeVersion: "RUNTIME_TYPE_VERSION" scriptLanguage: "SCRIPT_LANGUAGE" } status: STATUS steps: [ { ordinal: 0, type: NAVIGATE, values: ["MONITORED_URI", "USER_AGENT"] } { ordinal: STEP_NUMBER type: STEP_TYPE values: ["VALUE_1", "VALUE_2"] } ] advancedOptions: { enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT } apdexTarget: APDEX_TARGET } ) { errors { description type } }}Sample response
A successful response returns null for errors:
{ "data": { "syntheticsUpdateStepMonitor": { "errors": null } }}If there are any issues updating the monitor, the errors array will contain objects with description and type fields explaining what went wrong.
Delete a step monitor
When a step monitor is no longer needed, you can permanently remove it using the syntheticsDeleteMonitor mutation.
To delete a monitor, refer to the Delete Synthetic monitor section.