Sha256: cbe50243911211c3264e441b9dacc356d5662348fc083e7a424a48af721cd444
Contents?: true
Size: 695 Bytes
Versions: 1
Compression:
Stored size: 695 Bytes
Contents
require 'socket' require 'json' class Riemann::Babbler::Plugin::ResponderUdp < Riemann::Babbler::Plugin def init plugin.set_default(:port, opts.riemann.responder_udp_port) end def process(data, src) begin report(JSON.parse(data)) # symbolize event in sender src.reply "sended\n" rescue log :error, "Failed to send message: #{data.inspect}" src.reply "failed to send: #{data.inspect}\n" end end def run! log :unknown, "Start udp server at #{plugin.port}" Socket.udp_server_loop(plugin.port) do |data, src| log :debug, "Recived data: #{data.inspect}, from client: #{src.inspect}" process(data, src) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
riemann-babbler-2.1.0 | lib/riemann/babbler/plugins/responder_udp.rb |