Sha256: 0a5e6d5fba3cb4b5389df16986d13c32b71ee144b24a5b4e5f1d0e2297ed09a6
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require 'kurchatov/riemann/client' module Kurchatov module Responders class Riemann < Kurchatov::Plugin include Kurchatov::Mixin::Queue FLUSH_INTERVAL = 0.5 def initialize(conn) @ignore_errors = true @hosts = conn @riemanns = Array.new end def plugin_config {:hosts => @hosts} end def run super 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.to_flush 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kurchatov-0.0.6 | lib/kurchatov/responders/riemann.rb |