Sha256: 3f2f541411dda37d0176123520ba183c21547d7c6603f4176517e6f7997c7246

Contents?: true

Size: 527 Bytes

Versions: 3

Compression:

Stored size: 527 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
        begin
          @sock.send(pkt, 0)
        rescue SystemCallError
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
astro-collectd-0.0.11 lib/collectd/em_server.rb
astro-collectd-0.0.12 lib/collectd/em_server.rb
collectd-0.0.12 lib/collectd/em_server.rb