Synthetic monitoring in New Relic is a powerful tool that allows you to simulate and monitor the end-to-end user experience for your web applications. With synthetic monitoring, you can identify performance bottlenecks, track uptime, and analyze errors before they impact your users. In this guide, we will walk you through the steps needed to set up synthetic monitoring in New Relic.
Setting Up a New Relic Account
Before you can start using synthetic monitoring in New Relic, you will need to create an account. Visit the New Relic website, choose a pricing plan that suits your needs, and create an account with your email address.
Installing New Relic APM
To get synthetic monitoring to work in New Relic, you will need to have the New Relic APM (Application Performance Monitoring) installed on your application. Follow the appropriate instructions for your platform (Java, .NET, Ruby, Python, Node.js, etc.) in the New Relic documentation to install and configure the APM agent.
Creating a Synthetic Monitor
Once you have the APM agent installed and running, you can create a synthetic monitor in the New Relic dashboard. Follow these steps:
A. Log in to your New Relic account.
B. Navigate to the “Synthetics” tab in the top menu. C. Click the “Create monitor” button. D. Choose the monitor type. New Relic offers four types of synthetic monitors:
- Ping: A simple monitor that checks whether your application is reachable.
- Simple Browser: A monitor that navigates to a URL and measures the load time.
- Scripted Browser: A monitor that simulates user interactions using a script.
- API Test: A monitor that sends HTTP requests to your API endpoints. E. Configure the monitor settings, such as the URL to monitor, the monitoring frequency, and locations. F. Save the monitor.
Writing Scripts for Scripted Browser Monitors
A. Install the Selenium WebDriverJS library locally for development purposes. B. Write a script that performs the desired user interactions with your application. C. Test your script locally to ensure it works as expected. D. Copy your script to the “Script” field in the New Relic Synthetic Monitor settings. E. Save the monitor.
Monitoring and Analyzing Synthetic Test Results
Once you have created a synthetic monitor, it will start running at the specified frequency. You can view the results of your synthetic tests by navigating to the “Synthetics” tab in the New Relic dashboard. Here are some key metrics and features to analyze:
A. Uptime: The percentage of successful tests that indicate your application is accessible. B. Response Time: The time it takes for your application to load or respond to requests. C. Error Rate: The percentage of tests that failed due to errors. D. SLA Report: A summary of the monitor’s performance against predefined service-level agreements. E. Test Details: A detailed breakdown of each test run, including screenshots, waterfall charts, and error messages.
Setting Up Alerts
To stay informed about the performance of your synthetic monitors, you can set up alerts that notify you when certain conditions are met. Follow these steps:
A. Navigate to the “Alerts & AI” tab in the New Relic dashboard. B. Click the “Create alert policy” button. C. Name your policy and choose the desired incident preference.
D. Add a condition for your synthetic monitor, such as a threshold for response time or error rate. E. Configure notification channels, such as email, Slack, or PagerDuty, to receive alerts. F. Save the alert policy.
Synthetic monitoring is a critical tool for ensuring the performance and availability of your web applications. With New Relic, setting up and monitoring synthetic tests is a straightforward process. By following the steps outlined in this guide, you can quickly get synthetic monitoring up and running in your New Relic account, write scripts for scripted browser monitors, analyze test results, and set up alerts to stay informed about the performance of your application.