Skip to content

Commit

Permalink
Merge pull request newrelic#34 from jamsi/master
Browse files Browse the repository at this point in the history
Run newrelic_aws in a daemon
  • Loading branch information
Jason Stenhouse committed Apr 22, 2014
2 parents 89bb341 + f38040d commit 0df5619
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ source "https://rubygems.org"
gem 'newrelic_plugin', '~> 1.3.0'
gem 'nokogiri', '<= 1.5.9'
gem 'aws-sdk', '~> 1.24.0'
gem 'daemons'
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This tool provides the metric collection agents for the following New Relic plug

## Configuration

This plugin is configured through the `config/newrelic_plugin.yml` file. It requires:
This plugin is configured through the `config/newrelic_plugin.yml` file. It requires:

- a New Relic license key that can be found at https://rpm.newrelic.com/extensions/com.newrelic.aws.ec2
- an AWS Access Key
Expand Down Expand Up @@ -157,6 +157,13 @@ You can use services like these to manage this process.
- [Runit](http://smarden.org/runit/)
- [Monit](http://mmonit.com/monit/)

## Or run it as a daemon
The provided daemon.rb file allows newrelic_aws to run as a daemon.

chmod +x bin/daemon
bundle exec bin/daemon start
bundle exec bin/daemon stop

## For support
Plugin support and troubleshooting assistance can be obtained by visiting [support.newrelic.com](https://support.newrelic.com)

Expand Down
15 changes: 15 additions & 0 deletions bin/daemon
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby

#
# Start
# - bundle exec bin/daemon start
#
# Stop
# - bundle exec bin/daemon stop
#

require 'rubygems'
require 'daemons'

pwd = File.join(File.dirname(File.expand_path(__FILE__)), "../")
Daemons.run('bin/newrelic_aws', :dir_mode => :normal, :dir => pwd)
2 changes: 2 additions & 0 deletions bin/newrelic_aws
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ unless $:.include?(File.dirname(__FILE__) + '/../lib/')
$: << File.dirname(__FILE__) + '/../lib'
end

Dir.chdir(File.join(File.dirname(__FILE__), "../"))

STDOUT.sync = true

require 'newrelic_aws'

0 comments on commit 0df5619

Please sign in to comment.