This module contains two methods of notifying New Relic of a successful application deployment:
-
A Puppet type called
newrelic_notify
that will send deployment notifications to NewRelic via the Deployment API. -
A Puppet report processor for sending deployment events to NewRelic via the Deployment API.
- Puppet 2.6.5 or later
newrelic_api
gem- You will need to enable API access to your New Relic account. To do this, go to Account settings (upper right corner of the New Relic site), and then click on Integrations => Data Sharing. Select API access, and enable it.
-
Install the
newrelic_api
gem on your Puppet master$ sudo gem install newrelic_api
-
Install puppet-newrelic as a module in your Puppet master's module path.
To install the NewRelic RPM and API gems on the hosts with deployed
applications declare the newrelic
class.
class { 'newrelic':
enabled => 'true',
}
-
To use the
newrelic_notify
type enable pluginsync on your master and clients inpuppet.conf
[master] pluginsync = true [agent] pluginsync = true
-
Run the Puppet client and sync the type and provider as a plugin
-
You can then use the type and provider like so:
newrelic_notify { '123456': ensure => present, api_key => 'abc123', description => 'Notify New Relic that Application Bob was deployed.', revision => 'This is rev 1.0.1', user => 'Puppet', }
The
description
,revision
, anduser
parameters are optional.
-
To use the New Relic report processor update the
api_key
variable in thenewrelic.yaml
file with your New Relic API key.--- :api_key: 'abc123'
-
Add a list of your hosts to newrelic.yaml and match each host to the New Relic application deployed on it. Currently this is ugly and only supports one application per host. Anyone with ideas on how to do it better is welcomed. :)
--- :api_key: 'abc123' :hosts: - {host: 'hostname1', key: '123456'} - {host: 'hostname2', key: '123456'}
You can get the Application ID key from the New Relic url, for example: https://rpm.newrelic.com/accounts/17710/applications/56658. Where
56658
is the Application ID key. -
Copy
newrelic.yaml
to/etc/puppet
. -
Enable pluginsync and reports on your master and clients in
puppet.conf
[master] report = true reports = newrelic pluginsync = true [agent] report = true pluginsync = true
-
Run the Puppet client and sync the report as a plugin
James Turnbull [email protected]
Author:: James Turnbull (<[email protected]>)
Copyright:: Copyright (c) 2012 James Turnbull & Puppet Labs
License:: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.