Monitor Applications with the New Relic Add-on

New Relic application performance management solutions enable developers and operations teams to quickly and cost effectively monitor, troubleshoot, and tune application performance in real time. You can view the health and availability of your production app so you can be sure it's tuned, optimized, and running at its peak. New Relic provides app visibility such as aggregate app response time and throughput.

The New Relic add-on can help you understand if your app or your server needs help by providing real-time application performance. Server utilization info from the app perspective includes CPU utilization; network bandwidth, packets/sec, errors/sec; and server configuration summaries. For more information, see New Relic best practices.

Unless you're using an existing New Relic account (see below), the New Relic Standard plan is free for Engine Yard accounts. As an incentive, all new accounts start with a free 14-day trial of the New Relic Professional plan. If you select the Professional plan, the New Relic charge appears on your Engine Yard Cloud account bill. You do not get a separate bill from New Relic.

Important: New Relic are no longer providing partner accounts, so New Relic accounts must now be created directly with New Relic. If you previously set up New Relic with the original integration (Account Settings page), you should not attempt to use the new add-on with the same account. For new accounts, use the New Relic add-on, as described below. If you would like to convert from the original integration to the new add-on, contact Engine Yard Support.

Prerequisites

Before you set up the New Relic add-on, ensure that you have met the prerequisites:

  • If you have a trial Engine Yard account, you must upgrade to a full account before you can set up an add-on.

  • Consider which applications and environments need New Relic monitoring, and which plan is right for you.

  • You should be ready to deploy your application.

  • You should be ready to upgrade your environment (if it has not been upgraded since November 13th, 2012).

New Relic with Ruby

The New Relic add-on process for your Ruby application requires the following main steps:

New Relic with PHP

The New Relic add-on process for your PHP application only requires one main steps:

Set up the New Relic add-on service

Important: If you previously set up New Relic with the original integration (Account Settings page), you should not attempt to use the new add-on with the same account. If you would like to convert from the original integration to the new add-on, contact Engine Yard Support.

To sign up and activate your apps for New Relic monitoring

  1. Log in to your account.

  2. Navigate to this URL: https://addons.engineyard.com/addons/newrelic.

  3. Review the add-on details page to learn more about the New Relic service.

    Note: To have New Relic show servers with more descriptive hostnames (including the task the servers perform), submit a request to Support. Ask to have the value descriptive_hostname = "true" set to the metada configuration for the desired environments.

  4. (Optional).  If want to use an existing account, check the box 'Re-use an existing Account'.
  5. Click Set it up to accept the terms and conditions.

    If you are bringing an existing account, here is where its details have to be inserted.  Also, this steps sets up your New Relic login and password with SSO (providing the same sign-on as Engine Yard Cloud).

  6. On the New Relic Set it up page, select the environment you want to extend with New Relic monitoring.

    NewRelic_Activate.png

  7. Click Activate_Button.png to enable the New Relic add-on service for the selected environment.

  8. Navigate to your Environment page and click "Apply" for the changes to take effect.

    FOR PHP APPLICATIONS ONLY: Scroll to the bottom of the Environment page to confirm that New Relic is listed as an add-on.

    add_on_complete_php.png

    For a PHP application, you are done. Your New Relic add-on process is complete. Wait a few minutes for data to start reporting to New Relic.

    Note: If you have multiple apps/environments, then multiple selections appear in the list. Select and click Activate for each app / environment that you want to extend with New Relic.

Deploy the New Relic add-on service

You need to update code before the New Relic add-on service becomes available:

  • Modify your Gemfile.
  • Set up config/newrelic.yml.

Note: If your framework environment is not staging or production, you must add it to newrelic.yml.

Follow the instructions below (from the Set it up page).

To update and deploy your apps for New Relic monitoring

  1. Modify your Gemfile by adding the following lines:

    gem 'ey_config' 
    gem 'newrelic_rpm'
    
  2. Add the Engine Yard newrelic.yml to your application repository.

    • Download the Engine Yard version of newrelic.yml.

    • Place the newrelic.yml file in the config subdirectory of your application.

  3. Push all changes to your git repository host (e.g., GitHub).

  4. Click on the environment link to go to your application environment in Engine Yard Cloud.

    NewRelic_GotoDeploy.png

  5. On the environment page, click deploy_button.png to deploy the code changes for the New Relic add-on service.

    This deploys the changes to the Gemfile and to the config/newrelic.yml file.

  6. Click upgrade_button.png to ensure you have the November 13th, 2012 or later Engine Yard stack update, which includes database server monitoring.

    This installs the required New Relic functionality.

Note: If you have multiple apps/environments, then you need to repeat the steps in this section for each environment you are extending with New Relic.

Note: Your New Relic add-on charges (if any) appear on your Engine Yard Cloud account bill. You do not get a separate bill from New Relic.

Verify New Relic configuration

After an environment has been configured and updated with the New Relic add-on, verify the set up.

To verify the New Relic add-on

  1. Log in to your account.

  2. Navigate to this URL: https://addons.engineyard.com/addons/newrelic.

  3. Click  addons_newrelic_dashboard_link.png 

    The New Relic menu should look something like this:

    NewRelic_LeftMenu.png

  4. If you see this:

    NewRelic_SearchingForApp.png

    ... your app / environment is probably not yet deployed. See the Troubleshooting section below.

View New Relic performance data for your application

You can access your New Relic account directly from Engine Yard Cloud to view monitoring details about your application and its servers.

To view the New Relic add-on data

  1. Log in to your account.

  2. Navigate to this URL: https://addons.engineyard.com/addons/newrelic.

  3. Click  addons_newrelic_dashboard_link.png 

    This links to the New Relic website where you can review your data.

    NewRelic_LeftMenu.png

    Tip: Bookmark this New Relic URL.

  4. To view your application metrics, click the Applications link.

    Note: An "application" in New Relic terms is equivalent to an environment in Engine Yard Cloud.

  5. To view your server metrics, click the Servers link.

    New Relic server metrics are available for single server, app, app master, database, and utility servers.

Use New Relic deploy notifications

New Relic can help you keep track of your application deploys.

To track application deploys

  1. Add the following deploy hook to your application:

    # deploy/after_restart.rb
    run "cd #{config.release_path} && bundle exec rake RAILS_ENV=#{config.environment} APP=#{config.app} DEPLOYED_BY=\"#{config.deployed_by}\" REVISION=#{config.revision.chomp} NR_KEY=#{config.node[:newrelic_key]} newrelic:notify"
    
  2. Add the following Rake task to your application:

    # lib/tasks/newrelic.rake
    namespace :newrelic do
      task :notify => :environment do
        require 'newrelic_rpm'
     
        if Rails.env.production? 
          # Notify New Relic of deployment
          puts "Log deployment of #{ENV['REVISION']} with NewRelic"
          app = ""
          key = ""
          if ENV['NR_KEY'].blank?
            app = EY::Config.get("base", "app_environment_name")
            key = EY::Config.get("New Relic", 'license_key')
          else
            app = ENV['APP']
            key = ENV['NR_KEY']
          end
          begin
            `curl -H "x-license-key:#{key}" -d "deployment[app_name]=#{app}" -d "deployment[revision]=#{ENV['REVISION']}" -d "deployment[user]=#{ENV['DEPLOYED_BY']}" https://rpm.newrelic.com/deployments.xml`
          rescue  Exception => e  
            puts "The following error occurred: #{e.message}"
          end
        end
      end
    end
    
  3. Click Deploy.

Transfer Account Ownership

If you want to transfer your New Relic account to a new owner, you can do so on the New Relic UI.

To transfer your account to a new owner:

  1. Navigate to your New Relic dashboard.
  2. Click Account Settings tab.
  3. Click Add User.
  4. Enter the new user information.
  5. Click Change Owner.

    new_relic_ui.png

If you encounter problems with your New Relic account, such as no application data being reported, submit a ticket with Engine Yard Support

Troubleshooting

Symptom Solution
When I view the New Relic dashboard, it looks like it's not set up yet. The Gemfile was modified and we set up config/newrelic.yml.         You must click Deploy to update the configuration for each environment that you are extending with New Relic.
Server monitoring is not working.             You need a Chef run to install the New Relic daemon that monitors server resources. Click Upgrade on each environment that you are extending with New Relic. (Fixed in July 24, 2012 stack upgrade.)
Server monitoring does not work (/etc/newrelic/nrsysmond.cfg and /data/*/current/config/newrelic.yml have different license keys). We strongly recommend against using the original New Relic integration (Account Settings page) as well as the new add-on, as this issue results. You also will have double billing and the new account will not reflect historical data. If you would like to convert from the original integration to the new add-on, contact Engine Yard Support.

If you are testing:

Running in development mode - this error appears: Error reading newrelic.yml file: Expected to find EY::Config YAML file at one of: ["config/ey_services_config_deploy.yml", "config/ey_services_config_local.yml"] (RuntimeError)

New Relic doesn't require a valid license key in development mode. The easiest thing to do is create config/ey_services_config_local.yml
'New Relic':
license_key: "NA"
When you deploy, this file remains, however a config/ey_services_config_deploy.yml file is also written; it contains your real license key and takes precedence.
When I put the delayed_job gem into a "group" in the Gemfile, New Relic doesn't display stats for Delayed Job. Add the "group" to the require path for Rails. See The How and Why of Bundler Groups for more information.
Unable to login to the New Relic monitoring website via the Add-ons page or being redirected back to a login page. Deleting cookies and cache specifically to New Relic should allow you to login to the website 

 


If you have feedback or questions about this page, add a comment below. If you need help, submit a ticket with Engine Yard Support.

Comments

Please sign in to leave a comment.