0
votes

I have New Relic installed in a VPS. I have a "default" PHP Application and New Relic is getting data from it, but what server name is it getting from? The VPS contains some subdomains, and the server appears as "domain.com" (so I guess it is getting data from this server name). But I want to get data from "subdomain.domain.com". How can I achieve it?

Edit:

Following @Taibhse link (http://docs.newrelic.com/docs/agents/php-agent/configuration/php-directory-ini-settings#api-calls) I tried:

1. Change Apache2 configuration:

Inside <Directory ...>:

<IfModule php5_module>
    php_value newrelic.appname "myDomain.com"
</IfModule>

Also tried without <IfModule ...>, but nothing seemed to change.

2. Using API:

Then, I've tried adding:

if (extension_loaded('newrelic')) {
    newrelic_set_appname($name);
}

to the index.php file of one domain. And also without if (extension_loaded('newrelic')), but nothing changed again. It seems like it's getting data from all VirtualHost.

1

1 Answers

2
votes

I work for New Relic.

If I am following you correctly, You have a reporting application from "domain.com" and wish to get data from a subdomain also?

If you are using the same PHP environment on both domain and subdomain, the PHP agent should be collect data from both. If you wish to specify different applications to split the data, I suggesting using an API call. http://docs.newrelic.com/docs/agents/php-agent/configuration/php-directory-ini-settings#api-calls

Add this code to your subdomain:

if (extension_loaded('newrelic')) {
newrelic_set_appname($name);
}

Edit: Adding virtual host specific instructions.

We have some specifics for Virtual hosts in Apache: http://docs.newrelic.com/docs/agents/php-agent/configuration/php-directory-ini-settings#ini-apache

Within the VirtualHost tag, add:

<IfModule php5_module>
php_value newrelic.appname "Virtual Host 1"
</IfModule>

Once updated, you will need to restart Apache.

Let me know if you have any questions or need any further assistance.