Sha256: a75c51404d2f67819fb52fc88afa814c56f39792ba5a4ab310c8b5c06d46e0e4

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

require 'socket'
require 'thread'

module Collectd
  class Server < Values

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

      Thread.new do
        loop do
          sleep interval

          Collectd.run_pollables_for self
          Thread.critical = true
          pkt = make_pkt
          Thread.critical = false
          @sock.send(pkt, 0)
        end
      end.abort_on_exception = true
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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