New Relic is a powerful tool for monitoring and optimizing your application's performance. It helps you identify and fix issues before they affect your users.
To get started with New Relic, you'll need to install the agent in your application. This can be done through various methods, including manual installation, auto-instrumentation, and integration with popular frameworks.
New Relic provides a comprehensive dashboard that shows you key performance metrics, such as average response time, throughput, and error rates. These metrics are essential for understanding your application's behavior and identifying areas for improvement.
With New Relic, you can set up alerts and notifications to notify you of performance issues, so you can take action quickly. This helps you stay on top of your application's performance and ensure a smooth user experience.
Getting Started
To get started with New Relic Alerts, you need to have set up your server and have New Relic APM keeping an eye on it.
New Relic Alerts is a more modern alternative to the legacy alerts system, but it's okay to use both systems side by side. If you're already a New Relic user, you might want to think twice before switching to the new alerts system.
To enable New Relic Alerts, click on the "Become an early adopter" button at the bottom of the screen.
Get Started
Getting started with new tools can be intimidating, but don't worry, I'm here to guide you through it.
First, you need to set up your server and have New Relic APM keeping an eye on it. This will give you a solid foundation to build on.
To move forward, you'll need to set up alerts, which is the actual topic of this tutorial. You can use the legacy alerts system, but it's recommended to switch to the new Alerts functionality for better performance.
If you're an adventurous user, you can switch to the new Alerts functionality by clicking on the "Become an early adopter" button. Just be aware that there's no going back once you make the switch.
It's essential to avoid false alarms, just like the shepherd boy in Aesop's fable. This means selecting a channel carefully and setting up your alerts correctly.
To get started with Browser, a New Relic monitoring product, you'll need to select a channel and click "Add New Relic Integration".
What Is
Getting started with a new project can be overwhelming, but understanding the basics can make all the difference.
A project is a series of tasks that work together to achieve a specific goal.
Having a clear goal in mind is essential for any project.
A goal is a specific, measurable, achievable, relevant, and time-bound objective.
Breaking down a project into smaller tasks is a great way to stay organized.
Tasks can be categorized into three types: to-do, in-progress, and completed.
Setting deadlines for each task helps stay on track and manage time effectively.
Deadlines are a specific date or time by which a task must be completed.
Configuring New Relic
Configuring New Relic involves several steps, including setting up the New Relic account, installing the PHP agent, and configuring the server parameters. You can find the most up-to-date instructions on the New Relic documentation.
To configure New Relic on your server, you'll need to update the license, configure the PHP agent, and set the necessary server parameters. You can do this by editing the .user.ini file or by using the New Relic installation script.
Here are the steps to configure New Relic on your server:
By following these steps, you'll be able to configure New Relic on your server and start collecting data.
Configure OpenLiteSpeed
To configure OpenLiteSpeed for New Relic, you'll need to manually install the PHP Agent. As noted in Example 2, during the Guided Install process, the PHP Agent is not installed on OpenLiteSpeed servers.
The PHP Agent can be installed manually by setting up the necessary server parameters in your JVM_OPTS. For example, you'll need to set the $NEW_RELIC_ENDPOINT and $SERVICE_NAME variables.
To identify your GridGain nodes in New Relic, it's recommended to use consistent IDs, such as the GridGain node name. The sample configuration file maps many of GridGain's JMX metrics to New Relic, but you can import other metrics to meet your specific requirements.
Here's a step-by-step guide to configuring OpenLiteSpeed for New Relic:
1. Install the PHP Agent by running the following command: `sudo rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm`
2. Install the PHP agent by running the following command: `sudo yum install newrelic-php5`
3. Restart the web server to apply the changes: `/etc/init.d/httpd restart`
4. Configure the necessary server parameters in your JVM_OPTS, such as setting the $NEW_RELIC_ENDPOINT and $SERVICE_NAME variables.
By following these steps, you'll be able to configure OpenLiteSpeed for New Relic and start monitoring your application's performance.
What Are the Components?
Configuring New Relic involves understanding its key components.
New Relic's architecture is built around agents, which are software components that collect data from applications and send it to the New Relic platform for analysis.
The agent acts as a bridge between the application and the New Relic platform.
New Relic also uses a concept called a "collector" to collect data from agents and other sources.
Data is then processed and stored in the New Relic platform for analysis and visualization.
New Relic provides various types of data, including performance data, error data, and user data.
This data is used to create dashboards and charts that provide insights into application performance and user behavior.
Notifications and Alerts
You can configure New Relic to send notifications to your preferred communication method, such as email or Slack.
New Relic offers a feature called Managed Alerts, which enables users to monitor and oversee performance metrics effectively.
To set up Slack notifications, click on the down arrow next to your user name to open the menu, then select Configure Integrations.
Choose or create a channel you want to post the notifications to, and return to the New Relic Alerts Notification channels page to create a new notification channel selecting Slack as the Channel type.
You can use the Team channel field to define the name of the Slack channel you want the notifications to be posted to, but make sure to include the hash sign in front of the name.
New Relic Alerts incorporate diverse notification channels, including webhooks, Slack rooms, emails, etc.
Here are the types of notification channels available in New Relic Alerts:
New Relic Alerts are grouped into alert policies that each have their own sets of notification channels.
You can create a simple, all-encompassing alert policy to start with, and then come back to it and change your alert policies later as you get more familiar with the concept.
To create an alert policy, type the name in the text box that says Team name or service name and click on Create policy.
Test by Making Your Code Fail
To test your New Relic alert, you'll want to intentionally make your code fail. This will trigger the alert and allow you to see how it works in action.
First, connect to your server via SSH and navigate to your web server's root directory. The command to do this is `cd /var/www/html`.
Create a PHP file called `error.php` and add some faulty code to it. This code should be something that will cause a syntax error when you try to load it in your browser. Here's an example of what the code might look like:
```php
syntax_error.
echo"Hello, world";
?>
```
Load the URL of your server in your web browser and refresh it a few times during the five-minute time frame defined for the alert condition. You'll find your server's URL in the Amazon EC2 dashboard.
As you wait for the alert to trigger, you'll receive an email notification with the error details. This will show you what the alert looks like and how it's formatted.
Once you've acknowledged the alert, you'll see a change in the status of the alert. You'll also receive a notification about the acknowledgement via email and Slack. This means you've taken ownership of fixing the issue, and the status cannot be changed.
Metrics and Data
New Relic offers a wide range of metrics to help you monitor your application's performance. These metrics can be used to create alerts and visualize data in a dashboard.
You can use APM metrics to monitor your application's performance, including Apdex, Response Time, and Throughput. Apdex measures end user satisfaction, Response Time tells you how long requests take, and Throughput describes how many requests are successfully processed.
Custom metrics can also be used to create application-specific alert conditions. This is useful if you're recording your own custom metrics in APM.
Browser metrics can be used to pinpoint errors that cause the user experience to break. This includes metrics like End User Apdex, Page Load Time, and Page Views with JavaScript Errors.
Servers metrics can be used to monitor physical server performance, including CPU %, Disk IO%, Memory %, Fullest Disk %, and Load Average.
New Relic APM has various features, including Focus on Specific Transactions, Monitoring Database Queries, and App Map. This helps you track and monitor critical customer actions, gain insights into database queries, and understand your application's ecosystem.
Here are some sample NRQL queries used to create widgets in a dashboard:
Visualizing Data
Visualizing Data is a powerful way to gain insights into your application's performance. You can create dashboards to focus on specific areas, such as eCommerce or server health.
New Relic users have multiple ways to create dashboards, and WP Engine has made it easy with pre-built NRQL queries. These queries are customized for WordPress users and provide a simplified way to visualize data.
WP Engine has created a handful of NRQL queries to make building a dashboard in New Relic One easy and intuitive. You can find examples of these queries on the New Relic One documentation page.
To create a custom widget, you can use the NRQL Query Language or basic. If you wish to expand, change or display other information, you can find examples of NRQL queries on the New Relic One documentation page.
To add a widget to your dashboard, follow these steps:
- Name the dashboard something easily identifiable
- Ensure the correct Account is selected from the dropdown
- Click the plus sign + Add a new chart (hover over the blank squares)
- Select Add a chart
- Click NRQL query
- Enter your widget’s NRQL
- Click Run and Save
Once a widget has been added, the dashboard will update with data automatically. You can further customize the dashboard with images or graphics by selecting Add text, images or links when adding a widget.
Infrastructure and Logs
You gain access to New Relic Infrastructure in Pro projects, which seamlessly integrates with your application data and performance analytics. It provides real-time server monitoring capabilities to enhance your overall infrastructure management.
New Relic Infrastructure is accessible in both Production and Staging environments. To ensure proper functioning, you must have New Relic APM installed on both Staging and Production environments.
The New Relic Logs service is a standard inclusion within all cloud infrastructure projects, synchronizing application, infrastructure, and network logs to the New Relic platform.
Here are the benefits of using New Relic Logs:
- Efficient Troubleshooting: It reduces the time needed for troubleshooting by effectively organizing and presenting log data.
- Automatic Clustering: Logs are automatically clustered into visible patterns for easier analysis.
- User-Friendly Search and Filtering: It provides a user-friendly interface that simplifies log information search and filtration.
- Advanced Analysis Tools: Enables the creation of queries, alerts, and dashboards for deeper and more detailed analysis.
New Relic Logs covers a range of logs from various sources, including Adobe Commerce Cloud infrastructure, Adobe Commerce Cloud applications, services such as PHP, MySQL, Elasticsearch, custom logs (var/log), and CDN-WAF logs.
Installing the Infrastructure Agent is a straightforward process, indicated by the message "==> Installing Infrastructure Agent...success." Once installed, New Relic is set up on your server.
If you encounter issues during the installation of Logs Integration, you can try solving the problem by running a specific command and then retrying the guided install.
Frequently Asked Questions
What language does New Relic use?
New Relic uses NRQL, a query language similar to ANSI SQL, to retrieve detailed data and gain insights into applications and business activity. With NRQL, you can unlock valuable information to optimize your systems and improve performance.
How do I use the New Relic dashboard?
To import a New Relic dashboard, copy the JSON code from an existing dashboard and paste it into the Import dashboard field. This will create a new dashboard with the same settings and visualizations as the original.
How do I know if my New Relic is running?
To check if your New Relic agent is running, use the command `sudo systemctl status newrelic-infra`. If it's not running, start it manually with `sudo systemctl start newrelic-infra`.
Sources
- https://code.tutsplus.com/get-started-with-monitoring-your-web-application-using-new-relic-alerts--cms-24187t
- https://wpengine.com/support/new-relic-dashboard/
- https://www.mgt-commerce.com/tutorial/magento-2-new-relic-integration/
- https://gridpane.com/kb/installing-and-configuring-new-relic-for-wordpress/
- https://www.gridgain.com/docs/tutorials/new-relic/new-relic-tutorial
Featured Images: pexels.com