Configure New Relic Infrastructure using Chef

This document provides basic information about how to use New Relic's Chef recipes to install and configure New Relic Infrastructure. For instructions on how to use Chef recipes, see the Chef documentation.

The New Relic cookbook is available from the public Chef Supermarket. This is a community-supported effort.

Compatibility and requirements

The Infrastructure Chef recipe has the following requirements:

Chef recipes

New Relic Infrastructure has one default recipe: default. Include this recipe to install and configure the Infrastructure agent. If this recipe detects an unsupported platform or version, the Chef run fails. Configuration depends on your specific setup and standards.

Chef attributes

The default recipe supplies the following Chef attributes:

default['newrelic_infra']['config']['license_key'] (REQUIRED)
Type String
Default (none)

Defines your New Relic license key.

default['newrelic_infra']['packages']['agent']['action']
Type String
Default install
Valid values install, upgrade, or remove

Select what type of package resource actions action you want to perform:

  • install: Installs the Infrastructure agent. If [agent_version] is specified, that version will be installed. The first time the cookbook runs on each host, it will install the latest Infrastructure agent. However, the agent will not be upgraded with install on subsequent Chef runs. Use upgrade to install newer versions.

  • upgrade: Upgrades hosts to the latest Infrastructure agent version.

  • remove: Uninstalls the Infrastructure agent.

default['newrelic_infra']['packages']['agent']['retries']
Type Integer
Default 0

The number of times to catch exceptions and retry the resource.

default['newrelic_infra']['packages']['agent']['version']
Type String
Default (none)

Use with 'install' to set a specific agent version. If no value is set, the recipe defaults to the latest agent version.

Use the basic recipe

The New Relic cookbook is available from the public Chef Supermarket. To install and configure New Relic Infrastructure using Chef:

  1. Add the newrelic-infra dependency in your own Chef metadata.rb or Berksfile.
  2. Set the New Relic license key attribute. For example, add the following to your recipes/default.rb:

    default['newrelic_infra']['config']['license_key'] = 'YOUR_LICENSE_KEY'
    
  3. Optional: To control version usage and updating, customize the recipe with Chef attributes.
  4. Include the default New Relic recipe by using include_recipe ‘newrelic-infra::default' or by adding the recipe to your run list.

For more help

If you need additional help, file an issue at newrelic/infrastructure-agent-chef on GitHub.

Recommendations for learning more: