Tutorial: New Relic monitoring

Edit on GitHub
For existing Spryker Cloud Customers, the NewRelic APM is already preconfigured and just needs to be activated by requesting access [here](https://spryker.force.com/support/s/hosting-change-requests/change-request-monitoring-access). Please note the access access can only be requested by a direct customer, not a partner. Please also note that only the NewRelic APM account provided by Spryker should be used. It is not possible to use existing NewRelic APM accounts on a PaaS environment, as this would conflict with our monitoring setup.

Installing the PHP agent

When accessing your New Relic APM dashboard, you are asked to download and set up the New Relic agent:

New Relic - Step 1

It is important to generate a LICENSE KEY (which is different from the API KEY):

New Relic - Step 2

Then, you can install the New Relic agent:

New Relic - Step 3

Here is the instruction for a default Linux installation:

$ wget http://download.newrelic.com/php_agent/release/newrelic-php5-X.X.X.X-OS.tar.gz
$ sudo gzip -dc newrelic-php5-X.X.X.X-OS.tar.gz | tar xf -
$ cd newrelic-php5-X.X.X.X
$ sudo ./newrelic-install install

Enter the license key and follow the instructions:

New Relic - Step 4

Once the installation is finished, check/modify the following files: a mapping default fpm (web) transaction to the default Yves, and the console commands (non-web) to the default Zed.

/etc/php/7.2/cli/conf.d/newrelic.ini

newrelic.appname = "YVES-DE (environment)"
newrelic.framework = "no_framework"

/etc/php/7.2/fpm/conf.d/newrelic.ini

newrelic.appname = "ZED-DE (environment)"
newrelic.framework = "no_framework"

Additionally, if, for some reasons, the transactions return some erroneous data, these values can be set in one or both newrelic.ini files:

newrelic.browser_monitoring.auto_instrument = false
newrelic.transaction_tracer.enabled = false

The same is for the vhost configuration of php parameters.

/etc/php/7.2/fpm/pool.d/environment-yves.conf

php_admin_value[newrelic.appname] = "YVES-DE (environment)"
php_admin_value[newrelic.framework] = "no_framework"

/etc/php/7.2/fpm/pool.d/environment-zed.conf

php_admin_value[newrelic.appname] = "ZED-DE (environment)"
php_admin_value[newrelic.framework] = "no_framework"

Then, restart fpm and Nginx, and check that the New Relic daemon is up and running:

$ sudo service php7.2-fpm restart
$ sudo service nginx restart
$ sudo /etc/init.d/newrelic-daemon status

To enable or migrate New Relic packages, check the following documents: