New Relic – Monitor multiple web applications or virtual hosts

If you follow the New Relic instruction to setup the daemon. You will get all web applications as a single New Relic App named as PHP Application in the New Relic application console.

So how could we setup multiple New Relic Apps for different virtual hosts in Apache? Here you are.

1. Make sure you have enabled the Apache php5 module. If it is not enabled, enable it by the following command with root privilege.

a2enmod php5

 

2. For the virtual hosts which you want to enable the New Relic monitor, add the newrelic.appname in the VirtualHost file as follow.

<VirtualHost 192.168.42.43>
  ServerName www.myvhost1.com
  DocumentRoot "/path/to/vhost1/"
  ...
  #Enable New Relic monitor
  <IfModule php5_module>
    php_value newrelic.appname "Virtual Host 1"
  </IfModule>
</VirtualHost>

 

3. On the other hand, if you want to disable the monitor, edit the VirtualHost as follow.

<VirtualHost 192.168.42.43>
  ServerName www.myvhost1.com
  DocumentRoot "/path/to/vhost1/"
  ...
  #Disable New Relic monitor
  <IfModule php5_module>
    php_flag newrelic.enabled off
  </IfModule>
</VirtualHost>

 

4. Restart the New Relic dameon.

/etc/init.d/newrelic-daemon restart

 

5. Restart the Apache.

/etc/init.d/apache2 restart

 

6. Open a browser an access the websites which have New Relic monitor enabled.
 

7. Check your New Relic application console.

Done =)

Reference: Per-directory INI Settings

Advertisements

5 thoughts on “New Relic – Monitor multiple web applications or virtual hosts”

  1. Be aware they send you lots of spam
    and do not give promised t-shirt

    AFAIK the monitoring tool is not free

    Sooo…

    Like

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