Sha256: bdc83ad2f0cdf07b30b41416d52185698a7a879cad04719e4b164225b2455bfd

Contents?: true

Size: 468 Bytes

Versions: 5

Compression:

Stored size: 468 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
        Thread.critical = true
        pkt = make_pkt
        Thread.critical = false
        @sock.send(pkt, 0)
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
astro-collectd-0.0.10 lib/collectd/em_server.rb
astro-collectd-0.0.5 lib/collectd/em_server.rb
astro-collectd-0.0.7 lib/collectd/em_server.rb
astro-collectd-0.0.8 lib/collectd/em_server.rb
astro-collectd-0.0.9 lib/collectd/em_server.rb