Sha256: c408838ee2ab8a4540e76f828e7764dfe343773a2c4ac1af433fd11e5a1aecee
Contents?: true
Size: 753 Bytes
Versions: 22
Compression:
Stored size: 753 Bytes
Contents
require 'socket' class Riemann::Babbler::Plugin::ResponderUdp < Riemann::Babbler::Plugin def init host, port = opts.riemann.responder_bind_udp.split(':') plugin.set_default(:port, port) plugin.set_default(:host, host) end def process(data, src) begin report event_from_json(data) 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.host}:#{plugin.port}" Socket.udp_server_loop(plugin.host, plugin.port) do |data, src| log :debug, "Recived data: #{data.inspect}, from client: #{src.inspect}" process(data, src) end end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
riemann-babbler-2.1.3.1 | lib/riemann/babbler/plugins/responder_udp.rb |
riemann-babbler-2.1.3 | lib/riemann/babbler/plugins/responder_udp.rb |