Sha256: ca56ecf5b15843b331673337941428aa636582fb871c93a0ad96fbcd27b41dcc

Contents?: true

Size: 1.84 KB

Versions: 4

Compression:

Stored size: 1.84 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_bind_http, 'Bind to http responder', :default => '0.0.0.0:55755'
  opt :responder_bind_udp, 'Bind to udp responder', :default => '127.0.0.1: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

4 entries across 4 versions & 1 rubygems

Version Path
riemann-babbler-2.1.4 bin/riemann-babbler
riemann-babbler-2.1.3.2 bin/riemann-babbler
riemann-babbler-2.1.3.1 bin/riemann-babbler
riemann-babbler-2.1.3 bin/riemann-babbler