Sha256: c790bbed0265d591b7c0a23295661246ec974a37562450af482cc330cf9804fc

Contents?: true

Size: 1.83 KB

Versions: 5

Compression:

Stored size: 1.83 KB

Contents

#!/usr/bin/env ruby
# coding: utf-8

require 'trollop'
require 'yaml'
require_relative '../lib/riemann/babbler'

include Riemann::Babbler::Logging
include Riemann::Babbler::Options

cmd_opts = Trollop::options do
  version "Riemann babbler #{Riemann::Babbler::VERSION}"
  banner <<-EOS
Riemann-babbler is tool for monitoring with riemann.

Usage:
       riemann-babbler [options]
where [options] are:
  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 :minimize_event_count, 'Minimize count of sent messages', :default => true
  opt :responder_http_port, 'Port to bind http responder', :default => 55755
  opt :responder_udp_port, 'Port to bind tcp responder', :default => 55955
end

# 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
sender = Riemann::Babbler::Sender.new
plugins_to_start = Riemann::Babbler::PluginLoader.new.plugin_to_start
Riemann::Babbler::PluginManager.new(sender, plugins_to_start).run!

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
riemann-babbler-2.1.2 bin/riemann-babbler
riemann-babbler-2.1.1 bin/riemann-babbler
riemann-babbler-2.1.0 bin/riemann-babbler
riemann-babbler-2.0.9 bin/riemann-babbler
riemann-babbler-2.0.8 bin/riemann-babbler