Primary Menu
If you don’t already have a New Relic account, you can sign up for one here:
Installing and Configuring New Relic for WordPress
Third-Party Software Notice Our support team cannot provide support for third-party software and services. However, if you spot an issue with this article please let us know and we will endeavor to bring it up-to-date ASAP.
Introduction
New Relic One is a powerful full-stack data analysis platform for all your software’s metrics, events, and logs.
Their new pricing model makes their software a lot more accessible than it was previously and now even includes a free tier.
In parts 1, 2, and 3 we’ll walk through how to install New Relic on your GridPane provisioned servers, and then we’ll look at how to finish up the configuration for Nginx and OpenLiteSpeed in their own respective sections (note that the PHP Agent installation on OpenLiteSpeed is done separately). After this there are additional sections on setting up your websites for monitoring in New Relic, and setting up additional logging if you’d like to do so.
Click on the images throughout the article to zoom in.
- Install Part 1. Get Your New Relic Install Command
- Install Part 2. Server Preparation
- Install Part 3. Install New Relic on Your Server
- Configure New Relic on Nginx
- Configure New Relic on OpenLiteSpeed
- Configure Your Websites
- Add Additional Logs (Optional)
- Uninstall New Relic
Please note that our support team is not available to answer questions around third-party software that is not a part of the GridPane stack, however, if you think this article needs updating or can be improved, please let us know.
Also, special thanks to Sean Vandermolen for the information he contributed to the GridPane Facebook community on installing New Relic on GridPane. That information provided the foundation for this article.
Install Part 1. Get Your New Relic Install Command
If you don’t already have a New Relic account, you can sign up for one here:
I’d recommend you choose the EU option when signing up.
Inside your New Relic account, click the “Add some data” button to get started:
Guided Install
We’re going to use the Guided Install to monitor your Logs, PHP, MySQL, and Redis:
And now click the “Begin installation” button:
Installation Script
New Relic will now create a 1 line command that you can copy and paste into your server. Before that though, we need to first complete Part 2 below.
Install Part 2. Server Preparation
Before running the New Relic install command you’ve just generated we first need to do some server prep so that both you and the server are ready for the installation process.
MySQL Root Password
If you want New Relic to monitor MySQL, you’ll need to copy your MySQL root password BEFORE running the install commands, as it will ask you for this during the installation process.
You can display your root password in the terminal with this command:
gp mysql -get-pass root
Nginx Server PHP Preparation
Out of the box, the New Relic PHP installer isn’t able to identify the multiple PHP versions installed on the system. To solve for this we can symlink current to PHP directories with the paths that New Relic looks for by default.*
Run the following commands on your server:
mkdir -p /opt/php-7.1/bin /opt/php-7.2/bin /opt/php-7.3/bin /opt/php-7.4/bin /opt/php-8.0/bin /opt/php-8.1/bin
ln -s /usr/bin/php7.1 /opt/php-7.1/bin/php
ln -s /usr/bin/php7.2 /opt/php-7.2/bin/php
ln -s /usr/bin/php7.3 /opt/php-7.3/bin/php
ln -s /usr/bin/php7.4 /opt/php-7.4/bin/php
ln -s /usr/bin/php7.4 /opt/php-8.0/bin/php
ln -s /usr/bin/php7.4 /opt/php-8.1/bin/php
*Again, special thanks to Sean Vandermolen for contributing the above information.
OpenLiteSpeed Server PHP Preparation
Just grab the MySQL password as detailed above.
No additional server preparation is necessary. We will install PHP separately after running the guided install.
Install Part 3. Install New Relic on Your Server
We’re now ready to run the installation script on your server.
Copy the command that was generated by following Install Part 1 above and hit Enter.
Guided Install Rundown
The script will first give you a rundown of the components to be installed (on OpenLiteSpeed the PHP Agent will be missing). Hit Enter to continue.
1. Installing Infrastructure Agent
First up the Infrastructure Agent will run, and its completion ends with:
==> Installing Infrastructure Agent. success.
2. Installing Logs Integration
The Logs Integration will prompt you to confirm whether you want to tail these logs:
Hit Y and then Enter.
If your installation fails here with the following message:
“We encountered an issue during the installation: encountered an error while validating receipt of data for logs-integration: no validation was successful. most recent validation error: reached max validation attempts: no results returned.”
You should be able to solve this by running the following:
apt install td-agent-bit
Once installed, you can try the guided install again.
3. Installing Golden Signal Alerts
If you’d like New Relic to email you when the outlined alerts take place, hit Y and then Enter.
This will notify the email attached to your New Relic account.
4. Installing Memcached Open Source Integration
During the Memcached install, just hit Enter.
5. Installing MySQL Open Source Integration
The MySQL install will prompt you for the password that we ran the command for during the Install Part 2 section above.
Paste this and hit Enter. Entering passwords doesn’t give visual feedback on the command line, so it’s fine to hit Enter even though it doesn’t display.
6. Installing PHP Agent Installer for Debian
OpenLiteSpeed Note: In multiple tests while writing this article, the guided install does not attempt to install the PHP Agent on OLS. We’ll configure this separately in the OpenLiteSpeed section that follows.
The PHP installer will ask for a server name. Here you may want to enter your server name and then hit Enter. This will attempt to add your server name as the newrelic.appname inside the newrelic.ini files for each version of PHP.
NOTE: Chances are it won’t change everything on Nginx so we’ll look at this in the following Nginx section.
The installer will then ask if you want to restart PHP. Hit y and then Enter.
Next, it will ask if you want to install the PHP Agent. Hit Y and then Enter.
7. Installing Redis Open Source Integration
All of the defaults are correct for Redis. Hit Enter for each option to complete the installation process.
8. Installation Complete!
Redis is the final component of the installation process. Once it’s complete you’ll see a summary:
Also, during the process, you’ll see each component being updated inside your New Relic account:
And once complete:
You can now click the “See your data” button to head to the server’s APM info.
Configure New Relic on Nginx
With New Relic installed, we now need to update/configure a few things to finish up.
1. “20-newrelic.ini” Removal
After the installation process is complete, if you run:
php -v
You may see a warning that reads: PHP Warning: Module ‘newrelic’ already loaded in Unknown on line 0 .
This same warning will also show up when restarting any version of PHP.
This is due to the additional 20-newrelic.ini inside the /etc/php/7.*/fpm/conf.d .
(* meaning 7.1, 7.2, 7.3, 7.4).
Remove these with this command:
rm /etc/php/7.*/fpm/conf.d/20-newrelic.ini
And also the following to clear any that exist inside /etc/php/7.*/cli/conf.d :
rm /etc/php/7.*/cli/conf.d/20-newrelic.ini
2 . Update Application Name and License Key inside newrelic.ini files
If you run the following command you’ll likely find that the New Relic install process didn’t set your server name and/or license in every newrelic.ini file:
grep -inr "newrelic.appname newrelic.appname PHP Application" /etc/php/7.1/cli/conf.d/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/7.1/fpm/conf.d/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/7.2/mods-available/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/7.2/cli/conf.d/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/7.2/fpm/conf.d/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/7.3/mods-available/newrelic.ini:112:newrelic.appname color: #000000;">steve-server-ngx" /etc/php/7.3/cli/conf.d/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/8.0/mods-available/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/7.4/mods-available/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/7.4/cli/conf.d/newrelic.ini:112:newrelic.appname = "PHP Application" /etc/php/7.4/fpm/conf.d/newrelic.ini:112:newrelic.appname = "PHP Application"
Check the license with:
grep -inr "newrelic.license #configure-websites">Configure Your Websites section for details, then once done, reboot your server.
Comments are closed, but trackbacks and pingbacks are open.