How to configure NewRelic on server

How to configure NewRelic on server

\#main-header this is page.vmd

Skip to end of metadata

Go to start of metadata

  • Installing and Updating New Relic on server
  • NewRelic processes to know about
  • Configuring NewRelic php agent
    • Finding newrelic.ini file used by PHP in CLI
    • Finding newrelic.ini used if PHP works via webserver
    • Restarting your Apache or PHP FPM
  • Configuring NewRelic Server Monitor Agent
    • Update the license_key
    • Restart the newrelic-daemon and newrelic-sysmond
  • Configuring New Relic plugins
    • Update the license_key
    • Restart the newrelic-plugin-agent
  • Finding Licence Key in NewRelic

Installing and Updating New Relic on server

Php Agent installation:

https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-ubuntu-debian

Php Agent update:

https://docs.newrelic.com/docs/agents/php-agent/installation/upgrading-php-agent

NewRelic Server Daemon man page

https://docs.newrelic.com/docs/agents/php-agent/advanced-installation/starting-php-daemon-advanced

NewRelic processes to know about

Using grep find NewRelic specific processes from “ps aux”:

1

2

3

4

5

6

root@server-v260:/var/log/apache2# ps aux | grep relic

newrelic   … /usr/bin/python /usr/local/bin/newrelic-plugin-agent -c /etc/newrelic/newrelic-plugin-agent.cfg

root       … /usr/bin/newrelic-daemon -c /etc/newrelic/newrelic.cfg –pidfile /var/run/newrelic-daemon.pid

root       … /usr/bin/newrelic-daemon -c /etc/newrelic/newrelic.cfg –pidfile /var/run/newrelic-daemon.pid -no-pidfile

newrelic   … /usr/sbin/nrsysmond -c /etc/newrelic/nrsysmond.cfg -p /var/run/newrelic/nrsysmond.pid

newrelic   … /usr/sbin/nrsysmond -c /etc/newrelic/nrsysmond.cfg -p /var/run/newrelic/nrsysmond.pid

Configuring NewRelic php agent

Finding newrelic.ini file used by PHP in CLI

root@server-v260:/var/log/apache2# php –ini

PHP Warning:  Module ‘newrelic’ already loaded in Unknown on line 0

Configuration File (php.ini) Path: /etc/php5/cli

Loaded Configuration File:         /etc/php5/cli/php.ini

Scan for additional .ini files in: /etc/php5/cli/conf.d

Additional .ini files parsed:      /etc/php5/cli/conf.d/05-opcache.ini,

/etc/php5/cli/conf.d/10-pdo.ini,

/etc/php5/cli/conf.d/20-apcu.ini,

/etc/php5/cli/conf.d/20-curl.ini,

/etc/php5/cli/conf.d/20-gd.ini,

/etc/php5/cli/conf.d/20-intl.ini,

/etc/php5/cli/conf.d/20-json.ini,

/etc/php5/cli/conf.d/20-mcrypt.ini,

/etc/php5/cli/conf.d/20-mysql.ini,

/etc/php5/cli/conf.d/20-mysqli.ini,

/etc/php5/cli/conf.d/20-newrelic.ini,   <—– this is the one you need

/etc/php5/cli/conf.d/20-pdo_mysql.ini,

/etc/php5/cli/conf.d/20-readline.ini,

/etc/php5/cli/conf.d/20-redis.ini,

/etc/php5/cli/conf.d/20-xdebug.ini,

/etc/php5/cli/conf.d/20-xsl.ini,

/etc/php5/cli/conf.d/90-blackfire.ini

Result will show you a bunch of files from which you should open newrelic.ini. Be careful as sometimes php –ini shows few newrelic.ini files parsed. Then take the last one.

Finding newrelic.ini used if PHP works via webserver

Most likely it will be the same file as in (1). Nevertheless it’s better to check phpinfo() output for a correct ini file. Use our phpinfo.php available on each Vaimo server. It is accessible via url like

jambi@server-<servercode>.vaimo.com/__ic/phpinfo.php

E.g. jambi@server-v221.vaimo.com/__ic/phpinfo.php (do not disclose this URL to non vaimoers)

In both files update “newrelic.license” with a correct newrelic license key (see Finding Licence Key in NewRelic).

Restarting your Apache or PHP FPM

(in case php is installed as Apache module) or php5-fpm if you use PHP FPM:

$ sudo service apache2 restart

 

# or

 

$ sudo service php5-fpm restart

Configuring NewRelic Server Monitor Agent

Update the license_key

Open file

/etc/newrelic/nrsysmond.cfg

found via grep`ping “ps aux” output on “relic” as shown at the very beginning of the article and update “license_key” there with a correct one (see Finding Licence Key in NewRelic).

Restart the newrelic-daemon and newrelic-sysmond

Issue in terminal:

sudo /etc/init.d/newrelic-daemon restart

sudo /etc/init.d/newrelic-sysmond restart

Configuring New Relic plugins

Update the license_key

Find the following process among newrelic related processes on your machine (via grep`ping “ps aux” output on “relic” as shown at the very beginning of the article)

/usr/bin/python /usr/local/bin/newrelic-plugin-agent -c /etc/newrelic/newrelic-plugin-agent.cfg

And open the .cfg file. It is by default:

/etc/newrelic/newrelic-plugin-agent.cfg

Update “license_key” there with a correct one (see Finding Licence Key in NewRelic).

Restart the newrelic-plugin-agent

Kill the line from ps aux by process id and restart by re-issuing it in the terminal:

/usr/bin/python /usr/local/bin/newrelic-plugin-agent -c /etc/newrelic/newrelic-plugin-agent.cfg

Finding Licence Key in NewRelic

NewRelic license key which has a form of hash is specified on “Account Settings” page in NewRelic. Click in right top corner and choose “Account Settings” from the dropdown menu. 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s