Sha256: 0ffd8ac4e9ce96f8aeb4cc7252e1cbe05e0a6127a45a679d2ee3a923646380aa
Contents?: true
Size: 1003 Bytes
Versions: 3
Compression:
Stored size: 1003 Bytes
Contents
require 'kurchatov/riemann/client' module Kurchatov module Responders class Riemann < Kurchatov::Plugin include Kurchatov::Mixin::Queue FLUSH_INTERVAL = 0.5 def initialize(conn) @hosts = conn @riemanns = Array.new end def run make_clients loop { flush; sleep FLUSH_INTERVAL } end private def make_clients @riemanns.clear @hosts.each do |host| riemann, port = host.split(':') @riemanns << Kurchatov::Riemann::Client.new(:host => riemann, :port => port) @name = @riemanns.map { |c| "riemann client [#{c.host}:#{c.port}]" }.join(' , ') end end def flush @events_to_send ||= events.all unless @events_to_send.empty? @riemanns.each { |riemann| riemann << @events_to_send } Log.debug("Sended events via #{@name.inspect}: #{@events_to_send}") end @events_to_send = nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kurchatov-0.0.6.pre.2 | lib/kurchatov/responders/riemann.rb |
kurchatov-0.0.6.pre.1 | lib/kurchatov/responders/riemann.rb |
kurchatov-0.0.5 | lib/kurchatov/responders/riemann.rb |