How to Automate New Relic Monitoring (APM Reports, Alerts, Error-to-Tickets — No API Required)

Mar 5

Introduction

New Relic is used for application performance monitoring (APM), dashboards, alerting, and error tracking. While New Relic offers REST and NerdGraph APIs, browser automation provides a powerful solution for APM report exports, alert workflows, and error-to-ticket sync when API access is limited or when teams rely on the New Relic web UI.

Why Use Browser Automation for New Relic?

  • Limited API Access: API keys and rate limits can restrict bulk or UI-only workflows
  • APM Report Exports: Export APM reports, transaction traces, and performance data when API or built-in export is restricted
  • Alert Workflows: Configure alert conditions, notification channels, and run alert workflows from the portal
  • Error to Tickets: Turn errors and incidents into tickets in Jira, ServiceNow, or other systems when integrations are limited
  • UI-Only Features: Many APM and research views are easiest via the web interface
  • Cross-Account and Multi-Product: Operate across accounts and products (APM, Logs, Errors, etc.) in one session
  • Audit and Compliance: Export activity and report data for governance reviews

Setting Up New Relic Automation

Here's how to automate APM report exports, alert workflows, and error-to-tickets in New Relic using browser automation:



import { chromium } from 'playwright';

const response = await fetch("https://api.anchorbrowser.io/api/sessions", {
  method: "POST",
  headers: {
    "anchor-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    'headless': false,
    'proxy': { 'type': 'residential', 'country': 'US' }
  }),
});

const { id } = await response.json();
const connectionString = `wss://connect.anchorbrowser.io?apiKey=YOUR_API_KEY&sessionId=${id}`;

const browser = await chromium.connectOverCDP(connectionString);
const context = browser.contexts()[0];
const ai = context.serviceWorkers()[0];
const page = context.pages()[0];

await page.goto("https://one.newrelic.com");

await ai.evaluate(JSON.stringify({
  prompt: 'Log in to New Relic using the provided credentials. Complete SSO or 2FA if required and wait for the home or overview to load.'
}));



Use Case 1: APM Report Exports

Export APM reports, transaction data, and performance views from the New Relic UI:



const runApmReportExport = async (page, ai, criteria) => {
  await ai.evaluate(JSON.stringify({
    prompt: `Navigate to APM & services (or Applications). Open app ${criteria.appName || 'or list'}. Open Transactions or Summary.`
  }));
  
  await page.waitForLoadState('networkidle');
  
  await ai.evaluate(JSON.stringify({
    prompt: criteria.format === 'csv'
      ? 'Export the current view or table as CSV if available. Use Export or Download. Wait for download.'
      : criteria.format === 'pdf'
      ? 'Export or print view as PDF if available. Wait for download.'
      : 'Extract transaction names, throughput, error rate, response time. Return as JSON array.'
  }));
  
  const download = await page.waitForEvent('download', { timeout: 15000 }).catch(() => null);
  return { path: download ? await download.path() : null, completedAt: new Date().toISOString() };
};



Use Case 2: Alert Workflows

Manage alert conditions and notification channels from the portal:



const runAlertWorkflows = async (page, ai, criteria) => {
  await ai.evaluate(JSON.stringify({
    prompt: 'Navigate to Alerts & AI (or Alert conditions). Open conditions or notification channels.'
  }));
  
  await page.waitForLoadState('networkidle');
  
  await ai.evaluate(JSON.stringify({
    prompt: criteria.action === 'audit'
      ? 'Extract alert conditions and channels: name, type, threshold, targets. Return as structured JSON.'
      : criteria.action === 'mute'
      ? `Mute or snooze alert(s) matching ${criteria.scope || 'selection'}. Set duration if specified.`
      : 'List active alerts and their status. Return as JSON array.'
  }));
  
  await page.waitForLoadState('networkidle');
  
  const result = await ai.evaluate(JSON.stringify({
    prompt: 'Return summary: alerts updated or current config. As JSON. No API keys or secrets.'
  }));
  
  return { result: typeof result === 'string' ? JSON.parse(result) : result, completedAt: new Date().toISOString() };
};



Use Case 3: Error to Tickets

Turn errors and incidents into tickets in your ticketing system:



const runErrorToTickets = async (page, ai, criteria) => {
  await ai.evaluate(JSON.stringify({
    prompt: 'Navigate to Errors inbox or APM > Errors. Apply filters: application, time range, severity.'
  }));
  
  await page.waitForLoadState('networkidle');
  
  await ai.evaluate(JSON.stringify({
    prompt: criteria.action === 'list'
      ? 'List error summary: message, count, first/last seen, app. Return as JSON array.'
      : 'For each selected error (or top N), open detail. Extract message, stack, context. Return as JSON.'
  }));
  
  const errorsJson = await ai.evaluate(JSON.stringify({
    prompt: 'Return the extracted errors as a JSON array with title, message, count, link.'
  }));
  
  const errors = typeof errorsJson === 'string' ? JSON.parse(errorsJson) : errorsJson;
  
  if (criteria.ticketSystem === 'jira' || criteria.ticketSystem === 'servicenow') {
    await ai.evaluate(JSON.stringify({
      prompt: `Open ${criteria.ticketSystem}. For each error in the list, create a ticket with title and description (include New Relic link). Do not expose full stack in public fields if sensitive.`
    }));
  }
  
  return { ticketsCreated: errors.length, completedAt: new Date().toISOString() };
};



Exporting Activity and Audit Data

Pull report and audit data for compliance:



const exportNewRelicActivity = async (page, ai, scope) => {
  await ai.evaluate(JSON.stringify({
    prompt: scope === 'audit'
      ? 'Navigate to Account settings or Audit log. Set date range. Export or copy audit events.'
      : 'Navigate to APM, Alerts, or Errors. Export report or list. Wait for download if available.'
  }));
  
  const download = await page.waitForEvent('download', { timeout: 20000 }).catch(() => null);
  return download ? await download.path() : null;
};



Best Practices for New Relic Automation

  • Security: Use least-privilege API keys and SSO; never log credentials; respect New Relic ToS
  • APM Exports: Prefer NerdGraph or API where available; use browser for one-off or UI-only report export
  • Alert Workflows: Do not bypass notification policies; use automation for audit and bulk read first
  • Error to Tickets: Redact PII and secrets from ticket body; include link to New Relic only, not full payloads
  • Rate Limits: Add delays between actions to stay within New Relic rate limits
  • Error Handling: Retry on session timeout; handle SSO and 2FA gracefully
  • Compliance: Align automation with your org's monitoring and security policies

Handling Authentication

New Relic supports SSO (SAML, etc.) and 2FA:



const handleNewRelicAuth = async (page, ai, credentials) => {
  await page.goto("https://login.newrelic.com");
  
  await ai.evaluate(JSON.stringify({
    prompt: 'Sign in with the provided credentials. If SSO is required, complete org SSO.'
  }));
  
  await ai.evaluate(JSON.stringify({
    prompt: 'If 2FA is required, enter code from app or device. Wait for New Relic overview or APM to load.'
  }));
  
  await page.waitForLoadState('networkidle');
};



Resources

Conclusion

Browser automation provides a flexible alternative to API access for New Relic monitoring and research workflows. By using intelligent browser agents, you can automate APM report exports, alert workflows, and error-to-ticket sync directly from the New Relic web UI. Whether you need to export APM reports, manage alert conditions and channels, or turn errors into tickets in Jira or ServiceNow, browser automation enables efficient monitoring when API access is limited or when teams work in the portal.

Start automating your New Relic APM reports, alerts, and error-to-tickets today.

Other hubs

See all
No hubs found

Stay ahead in browser automation

We respect your inbox. Privacy policy

Welcome aboard! Thanks for signing up
Oops! Something went wrong while submitting the form.