Create and manage New Relic Synthetics scripted browser monitors via NerdGraph
domain: newrelic.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Use the syntheticsCreateScriptBrowserMonitor NerdGraph mutation to create a scripted browser monitor; supply the accountId, name, period (e.g., EVERY_10_MINUTES), status (ENABLED), locations (publicLocations list), and script fields.
Write the monitor script in Selenium WebDriver-compatible JavaScript (New Relic Synthetics uses a managed Selenium environment); use $browser and $driver globals to navigate, interact, and assert on page elements.
Encode the script as a plain string in the mutation's script.scriptText field; avoid hardcoding credentials — use $secure variables (defined separately in the New Relic UI or via syntheticsSecureCredential mutations) and reference them as $secure.MY_VAR in the script.
Set runtimeType to 'CHROME_BROWSER' and runtimeTypeVersion to the desired Chrome major version to opt into the newer runtime; omit these fields to use the legacy runtime, which has a different Node.js and Selenium version.
Query monitor status and recent results using the syntheticsMonitor field on the actor query, filtering by monitorId; retrieve lastCheck status, duration, and error details for alerting or reporting pipelines.
Create a New Relic alert condition using the NRQL condition mutation, querying the SyntheticCheck event filtered by monitorId and result = 'FAILED' for count-based alerting on synthetic failures.
Known gotchas
Scripted browser monitors run in an isolated container without access to local files or external npm packages; all helper logic must be inlined in the script or accessed via HTTP calls within the script.
The legacy Synthetics runtime (pre-2022) uses a different Selenium version and may behave differently for element selectors; check the runtimeType of existing monitors before migrating scripts to avoid selector breakage.
New Relic enforces a maximum script size; very large scripts (hundreds of kilobytes) are rejected at creation time — factor logic into reusable patterns within the script rather than inlining large data blobs.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp