Sha256: 66dcddccfb3866c02d659d8644dde0f2b9bf1a5d4665c468bbfef7801d51cf6a

Contents?: true

Size: 464 Bytes

Versions: 1

Compression:

Stored size: 464 Bytes

Contents

require 'eventmachine'

module Collectd
  class EmServer < Values

    def initialize(interval, host, port)
      super(interval)
      @sock = UDPSocket.new(host.index(':') ? Socket::AF_INET6 : Socket::AF_INET)
      @sock.connect(host, port)

      EM.add_periodic_timer(interval) do
        Collectd.run_pollables_for self
        pkt = make_pkt
        begin
          @sock.send(pkt, 0)
        rescue SystemCallError
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
collectd-0.0.15 lib/collectd/em_server.rb