Created
February 5, 2014 17:52
-
-
Save marianogg9/8829482 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'newrelic_plugin' | |
require 'getoptlong' | |
unless $:.include?(File.dirname(__FILE__) + '/../lib/') | |
$: << File.dirname(__FILE__) + '/../lib' | |
end | |
def usage | |
<<-EOF | |
newrelic_rs [OPTS] | |
--config-file -c: Path to configuration file | |
--help -h: This text | |
EOF | |
end | |
opts = GetoptLong.new( | |
['--config-file', '-c', GetoptLong::NO_ARGUMENT], | |
['--help', '-h', GetoptLong::NO_ARGUMENT] | |
) | |
opts.each do |opt,arg| | |
case opt | |
when '--config-file' | |
NewRelic::Plugin::Config.config_file = arg | |
else | |
puts usage | |
exit 1 | |
end | |
end | |
# Load any rackspace agents we find | |
NewRelic::Plugin::Config.config.options['agents'].find_all do |agent, opts| | |
agent.start_with?('rackspace_') && opts['enabled'] | |
end.each do |rackspace_agent, _| | |
require "newrelic_#{rackspace_agent}" | |
end | |
NewRelic::Plugin::Run.setup_and_run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment