Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

newrelic-ng (14) Versions 0.6.0

Installs/Configures newrelic monitoring

Policyfile
Berkshelf
Knife
cookbook 'newrelic-ng', '~> 0.6.0', :supermarket
cookbook 'newrelic-ng', '~> 0.6.0'
knife supermarket install newrelic-ng
knife supermarket download newrelic-ng
README
Dependencies
Changelog
Quality 17%

Build Status

newrelic-ng Cookbook

This cookbook provides LWRPs and recipes to install and configure different monitoring services for Newrelic.

  • Official Newrelic nrsysmond
  • MeetMe newrelic-plugin-agent
  • Generic ruby newrelic agents like
    • newrelic_sidekiq_agent
    • Should work with all ruby newrelic agents that are using config/newrelic_plugin.yml configuration file and newrelic_[NAME]_agent.daemon
  • PHP Agent

This cookbook requires Chef 11 or later.

Attributes

server monitoring with nrsysmond

You can set your Newrelic license key in the following attribute

node['newrelic-ng']['license_key'] = 'CHANGE_ME'

The 'config' attribute actually supports all other configuration options that nrsysmond accepts.
You can e.g. disable ssl

node['newrelic-ng']['nrsysmond']['config']['ssl'] = false

For a complete list of attributes, please see here

plugin-agent

You can set your New Relic license key, as well as other options in the following attribute (default values shown below)

node['newrelic-ng']['license_key'] = 'CHANGE_ME'
node['newrelic-ng']['plugin-agent']['poll_interval'] = 60
node['newrelic-ng']['plugin-agent']['pidfile'] = '/var/run/newrelic/newrelic-plugin-agent.pid'
node['newrelic-ng']['plugin-agent']['logfile'] = '/var/log/newrelic/newrelic-plugin-agent.log'

Set the pip package to install. Defaults to 'newrelic-plugin-agent'. You can set it e.g. to your GitHub fork

node.default['newrelic']['plugin-agent']['pip_package'] = 'git+git://github.com/chr4/newrelic-plugin-agent.git@fix-postgres-9.2'

For configuring your services, you need to insert a YAML string into the service_config attribute

node['newrelic-ng']['plugin-agent']['service_config'] = <<-EOS
postgresql:
  host: localhost
  port: 5432
  user: postgres
  dbname: postgres
EOS

generic-agent

Installs a generic plugin agent. E.g.

newrelic_sidekiq_agent:

default['newrelic-ng']['generic-agent']['agents']['sidekiq_status_agent'] = {
    source: 'https://github.com/eksoverzero/newrelic_sidekiq_agent/archive/V2.0.tar.gz',
    config: <<-EOS
- instance_name: "App name"
  uri: "redis://localhost:6379"
  namespace: "namespace"
EOS
  }
}

app-monitoring

These are used by the PHP Agent, and potentially could be used by the Java Agent & the Python Agent.

You’ll need to set the license key (shared amongst all the agents & the system monitor):

node['newrelic-ng']['license_key'] = 'CHANGE_ME'

Additionally, you have:

BASIC

  • node['newrelic-ng']['app_monitoring']['php-agent']['config_file'] – The path to the PHP agent config file; defaults to #{node['php']['ext_conf_dir']}/newrelic.ini
  • node['newrelic-ng']['app_monitoring']['php-agent']['startup_mode'] - The newrelic-daemon startup mode ("agent"/"external"), defaults to "agent"
  • node['newrelic-ng']['app_monitoring']['php-agent']['server_service_name'] - The web server service name, defaults to "apache2"

ADVANCED

These are not namespaced to php-agent, as they could later be shared amongst the Python agent, and the other non-Ruby-like agents.

New Relic’s PHP agent settings docs contain more details on these settings.

  • node['newrelic-ng']['app_monitoring']['enabled']
  • node['newrelic-ng']['app_monitoring']['logfile']
  • node['newrelic-ng']['app_monitoring']['loglevel']
  • node['newrelic-ng']['app_monitoring']['appname']
  • node['newrelic-ng']['app_monitoring']['daemon']['config_file']
  • node['newrelic-ng']['app_monitoring']['daemon']['upgrade_file']
  • node['newrelic-ng']['app_monitoring']['daemon']['logfile']
  • node['newrelic-ng']['app_monitoring']['daemon']['loglevel']
  • node['newrelic-ng']['app_monitoring']['daemon']['port']
  • node['newrelic-ng']['app_monitoring']['daemon']['max_threads']
  • node['newrelic-ng']['app_monitoring']['daemon']['ssl']
  • node['newrelic-ng']['app_monitoring']['daemon']['proxy']
  • node['newrelic-ng']['app_monitoring']['daemon']['pidfile']
  • node['newrelic-ng']['app_monitoring']['daemon']['location']
  • node['newrelic-ng']['app_monitoring']['daemon']['collector_host']
  • node['newrelic-ng']['app_monitoring']['daemon']['dont_launch']
  • node['newrelic-ng']['app_monitoring']['capture_params']
  • node['newrelic-ng']['app_monitoring']['ignored_params']
  • node['newrelic-ng']['app_monitoring']['error_collector']['enabled']
  • node['newrelic-ng']['app_monitoring']['error_collector']['record_database_errors']
  • node['newrelic-ng']['app_monitoring']['error_collector']['prioritize_api_errors']
  • node['newrelic-ng']['app_monitoring']['browser_monitoring']['auto_instrument']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['enabled']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['threshold']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['detail']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['slow_sql']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['stack_trace_threshold']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['explain_enabled']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['explain_threshold']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['record_sql']
  • node['newrelic-ng']['app_monitoring']['transaction_tracer']['custom']
  • node['newrelic-ng']['app_monitoring']['framework']
  • node['newrelic-ng']['app_monitoring']['webtransaction']['name']['remove_trailing_path']
  • node['newrelic-ng']['app_monitoring']['webtransaction']['name']['functions']
  • node['newrelic-ng']['app_monitoring']['webtransaction']['name']['files']
  • node['newrelic-ng']['app_monitoring']['daemon']['auditlog']
  • node['newrelic-ng']['app_monitoring']['analytics']['events']['enabled']
  • node['newrelic-ng']['app_monitoring']['high_security']

Recipes

To use the recipes, add the following to your metadata.rb

depends 'newrelic-ng'

default

  • Includes newrelic-ng::nrsysmond-default

nrsysmond-default

  • Includes newrelic-ng::nrsysmond-install
  • Configures and starts nrsysmond according to the attributes

nrsysmond-install

  • Includes newrelic-ng::newrelic-repository
  • Installs newrelic-sysmond package

plugin-agent-default

  • Includes newrelic-ng::plugin-agent-install
  • Configures and starts newrelic-plugin-agent according to the attributes

plugin-agent-install

  • Install python, python-pip and python-psycopg2
  • Install newrelic-plugin-agent using pip
  • Install newrelic-plugin-agent initscript (Debian, Ubuntu only)
  • Create run/log directories

generic-agent-default

  • Installs a generic newrelic agent.

newrelic-repository

  • Sets up the Newrelic apt/yum repository

php-agent-default

  • Install PHP (via the php cookbook, newrelic-php5
  • Run New Relic install script
  • Set up New Relic daemon according to startup_mode attribute:
    • Agent mode (i.e., no daemon)
    • External (i.e., daemon mode)

Providers

To use the providers, add the following to your metadata.rb

depends 'newrelic-ng'

newrelic_ng_nrsysmond

When nrsysmond is installed (e.g. using the newrelic-ng::nrsysmond-install recipe), you can configure it using the LWRP.

newrelic_ng_nrsysmond 'YOUR_LICENSE_KEY'

For more sophisticated setups, you can specify the follwoing additional attributes (they default to the node attributes)

newrelic_ng_nrsysmond 'custom' do
  license_key 'MY_PRODUCTION_KEY' if node.chef_environment == 'production'
  license_key 'MY_STAGING_KEY'    if node.chef_environment == 'staging'

  # additional nrsysmond configuration options
  hostname       node['fqdn']
  ssl            false
  loglevel       'info'
  proxy          nil
  ssl_ca_bundle  nil
  ssl_ca_path    '/myca/path'
  pidfile        '/tmp/nrsysmond.pid'
  collector_host 'my-collector-host.com'
  timeout        10

  # You can also set a custom label
  # labels       'label_type:label_value'

  # path and attributes of nrsysmond.cfg
  owner       'root'
  group       'root'
  mode        00600
  config_file '/etc/nrsysmond.cfg'

  # you can also specify your own configuration template
  cookbook    'yourcookbook'
  source      'yoursourcefile'
end

newrelic_ngi_plugini_agent

When the plugin-agent is installed (e.g. using the newrelic-ng::plugin-agent-install recipe), you can configure it using the LWRP.

newrelic_ng_plugin_agent 'YOUR_LICENSE_KEY'

For more sophisticated setups, you can specify the follwoing additional attributes (they default to the node attributes)

newrelic_ng_plugin_agent 'custom' do
  license_key 'MY_PRODUCTION_KEY' if node.chef_environment == 'production'
  license_key 'MY_STAGING_KEY'    if node.chef_environment == 'staging'

  # additional plugin-agent configuration options
  poll_interval  20
  logfile        '/tmp/plugin-agent.log'
  pidfile        '/tmp/plugin-agent.pid'

  # set your service configuration
  service_config <<-EOS
postgresql:
  host: localhost
  port: 5432
  user: postgres
  dbname: postgres
EOS

  # path and attributes of nrsysmond
  owner       'root'
  group       'root'
  mode        00600
  config_file '/etc/plugin-agent.cfg'

  # you can also specify your own configuration template
  cookbook    'yourcookbook'
  source      'yoursourcefile'
end

newrelic_ng_generic_agent

You can install and configure generic Ruby New Relic agents also via this LWRPs. For more information, see attributes and recipes section above.

Example:

newrelic_ng_generic_agent 'MY_LICENSE_KEY' do
  plugin_name 'sidekiq_status_agent'
  source 'https://github.com/eksoverzero/newrelic_sidekiq_agent/archive/V2.0.tar.gz'
  config <<-EOS
- instance_name: "App name"
  uri: "redis://localhost:6379"
  namespace: "namespace"
EOS
end

You can specify the following additional attributes

target_dir '/opt/newrelic-agents'
owner      'newrelic'
group      'newrelic'

The following actions are supported

action :install_and_configure # default
action :install               # only install the agent
action :configure             # only configure the agent

Contributing

e.g.

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change(s)
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using GitHub

License and Authors

Author: Chris Aumann me@chr4.org

Contributors: Cameron Johnston cameron@needle.com, Jeff Byrnes jeff@evertrue.com,
Chris Graham chris.graham@blackboard.com, Andy Thompson me@andytson.com,
Ofir Petrushka opetrushka@zendesk.com

License: GPLv3

CHANGELOG for newrelic-ng

This file is used to list changes made in each version of newrelic-ng.

0.6.0:

  • Use an apparently working key for testing
  • Fix an issue with external startup_mode. See this issue

0.5.4:

  • Fix attribute types, sometimes String was used, even though Boolean or Integer types were valid
  • Use node['root_group'] attribute as default group attribute for php-agent daemon config file
  • Use system wide ruby (install it if necessary) when installing newrelic generic agents
  • Remove nginx plugin agent support, as it has been moved to packages: See nr-plugin website

0.5.3:

  • Add "labels" option support for nrsysmond.cfg
  • Add rubocop linting

0.5.2:

  • Use NR_INSTALL_SILENT when installing php-agent

0.5.1:

  • Add hostname attribute to nrsysmond
  • Add high_security attribute to php-agent

0.5.0:

  • Change binary name to newrelic-plugin-agent (was newrelic_plugin_agent)
  • Upgrade newrelic-plugin-agent by default, in case an older version is installed

0.4.0:

  • Add support for php-agent, thanks to Jeff Byrnes!

0.3.4:

  • Add workaround for newrelic_generic_agent, was not starting up properly, due to bug in their status command

0.3.3:

  • Install plugin-agent dependencies automatically
  • KILL plugin-agent if TERM is not enough (after 10s)

0.3.2:

  • Fix default recipe

0.3.1:

  • Several small bugfixes

0.3.0:

  • Adds support for generic newrelic agents (e.g. newrelic_nginx_agent, newrelic_sidekiq_agent)

0.2.0:

  • Uses shared node['newrelic-ng']['license_key'] variable for all services
  • Fix a problem with newrelic-plugin-agent service not starting up properly
  • Migrate hashes to ruby-1.9 codestyle

0.1.0:

  • Initial release of newrelic-ng

Collaborator Number Metric
            

0.6.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.6.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.6.0 failed this metric

FC021: Resource condition in provider may not behave as expected: newrelic-ng/providers/php_agent.rb:28
FC021: Resource condition in provider may not behave as expected: newrelic-ng/providers/php_agent.rb:49
FC064: Ensure issues_url is set in metadata: newrelic-ng/metadata.rb:1
FC065: Ensure source_url is set in metadata: newrelic-ng/metadata.rb:1
FC066: Ensure chef_version is set in metadata: newrelic-ng/metadata.rb:1
FC069: Ensure standardized license defined in metadata: newrelic-ng/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/generic_agent.rb:89
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/nrsysmond.rb:53
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/php_agent.rb:70
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/php_agent.rb:95
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/plugin_agent.rb:52
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/user.rb:25
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/user.rb:33
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/user.rb:38
FC085: Resource using new_resource.updated_by_last_action to converge resource: newrelic-ng/providers/user.rb:41
FC109: Use platform-specific package resources instead of provider property: newrelic-ng/recipes/newrelic-repository.rb:37
FC120: Do not set the name property directly on a resource: newrelic-ng/providers/generic_agent.rb:38
FC120: Do not set the name property directly on a resource: newrelic-ng/recipes/plugin-agent-install.rb:31
FC121: Cookbook depends on cookbook made obsolete by Chef 14: newrelic-ng/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: newrelic-ng/recipes/plugin-agent-install.rb:22
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.6.0 passed this metric

Testing File Metric
            

0.6.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.6.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number