bin/riemann-babbler in riemann-babbler-1.4.0 vs bin/riemann-babbler in riemann-babbler-2.0.0pre1

- old
+ new

@@ -1,25 +1,45 @@ #!/usr/bin/env ruby # coding: utf-8 require 'trollop' -require 'configatron' +require 'yaml' +require_relative '../lib/riemann/babbler' +require_relative '../lib/riemann/babbler/plugin' -$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -require 'riemann/babbler/version' -require 'riemann/babbler/start' +include Riemann::Babbler::Logging +include Riemann::Babbler::Options -opts = Trollop::options do +cmd_opts = Trollop::options do version "Riemann babbler #{Riemann::Babbler::VERSION}" banner <<-EOS -Riemann-babbler is plugin manager for riemann-tools. +Riemann-babbler is tool for monitoring with riemann. Usage: - riemann-babbler [options] + riemann-babbler [options] where [options] are: -EOS + EOS opt :config, 'Config file', :default => '/etc/riemann-babbler/config.yml' + opt :host, 'Riemann host', :default => '127.0.0.1' + opt :port, 'Riemann port', :default => 5555 + opt :timeout, 'Riemann timeout', :default => 5 + #todo: opt :event_hostname, 'Event hostname', :type => String + opt :fqdn, 'Use fqdn for event hostname', :default => true + opt :ttl, 'TTL for events', :default => 60 + opt :interval, 'Seconds between updates', :default => 60 + opt :log_level, 'Level log', :default => 'DEBUG' + #todo: opt :log_output, 'Directions to puts your log', :default => STDOUT + #todo: opt :log_format, 'Log format', :default => '%Y-%m-%d %H:%M:%S' + opt :plugins_directory, 'Directory for plugins', :default => '/usr/share/riemann-babbler/plugins' + opt :tcp, 'Use TCP transport instead of UDP (improves reliability, slight overhead.', :default => true + opt :responder_port, 'Port to bind responder', :default => 55755 end -babbler = Riemann::Babbler::Starter.new(opts, configatron) -babbler.start! +# load current settings +opts.configure_from_hash({ :riemann => cmd_opts }) +@@logger.level = Logger.const_get(opts.riemann.log_level) #todo: to hard +merge_config(opts.riemann.config) + +# start +Riemann::Babbler::Responder.new.run! +Riemann::Babbler::PluginLoader.new(Riemann::Babbler::Sender.new).run!