Sha256: 05a6ec6922de6a68cebe73451de1efaf5f80b9c98d5dc0117a35267cd4b1c93c

Contents?: true

Size: 670 Bytes

Versions: 7

Compression:

Stored size: 670 Bytes

Contents

require 'kurchatov/riemann/client'

name 'riemann transport'
always_start true
ignore_errors true

default[:hosts] = Kurchatov::Config[:riemann_responder]

run_if do
  plugin.hosts.to_a.length > 0
end

helpers do

  def flush
    @events_to_send ||= events.to_flush
    unless @events_to_send.empty?
      @riemanns.each { |riemann| riemann << @events_to_send }
      Log.debug("Sended events: #{@events_to_send}")
    end
    @events_to_send = nil
  end

end

run do
  @riemanns = []
  plugin.hosts.each do |host|
    riemann, port = host.split(':')
    @riemanns << Kurchatov::Riemann::Client.new(:host => riemann, :port => port)
  end
  loop { flush; sleep 0.5 }
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kurchatov-0.4.7 lib/kurchatov/responders/riemann_transport.rb
kurchatov-0.4.6 lib/kurchatov/responders/riemann_transport.rb
kurchatov-0.4.5 lib/kurchatov/responders/riemann_transport.rb
kurchatov-0.4.4 lib/kurchatov/responders/riemann_transport.rb
kurchatov-0.4.3 lib/kurchatov/responders/riemann_transport.rb
kurchatov-0.4.2 lib/kurchatov/responders/riemann_transport.rb
kurchatov-0.4.1 lib/kurchatov/responders/riemann_transport.rb