Sha256: d4975b10052c9fb55134d6b94c9cfbde463039b053507da1ab6d0179d693adc8

Contents?: true

Size: 668 Bytes

Versions: 4

Compression:

Stored size: 668 Bytes

Contents

name 'http transport'

always_start true
ignore_errors true

default[:url] = Kurchatov::Config[:http_transport]

run_if do
  !!plugin.url
end

helpers do

  def flush
    @events_to_send ||= events.to_flush
    if !@events_to_send.empty?
      @body = {
          :service => 'service-status',
          :message_type => 'riemann_client_message',
          :message => {:events => @events_to_send}
      }.to_json
      Log.debug("Send body: #{@body}")
      _, code = http_post(plugin.url, @body)
      Log.error("Response code: #{code} from #{plugin.url}") if code == 0 || code > 300
    end
    @events_to_send = nil
  end

end

run do
  loop { flush; sleep 1 }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kurchatov-0.4.4 lib/kurchatov/responders/http_transport.rb
kurchatov-0.4.3 lib/kurchatov/responders/http_transport.rb
kurchatov-0.4.2 lib/kurchatov/responders/http_transport.rb
kurchatov-0.4.1 lib/kurchatov/responders/http_transport.rb