Sha256: 1e73a9e29983643d87e64e3731fc2d8af328a4d3389fc6e57315206c7c9bbc76

Contents?: true

Size: 478 Bytes

Versions: 4

Compression:

Stored size: 478 Bytes

Contents

require "socket"
require "json"

module Healthety
  class Transmission
    def initialize(server, port)
      @server = server
      @port = port
      @host = Socket.gethostname
      @socket = UDPSocket.new
    end

    def send(name, value, created_at)
      data = {
        :name => name, :value => value,
        :created_at => created_at, :host => @host
      }.to_json
      @socket.send(data, 0, @server, @port)
      $stdout << "#{name}: #{value}\n"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
healthety-0.0.5 lib/healthety/transmission.rb
healthety-0.0.4 lib/healthety/transmission.rb
healthety-0.0.3 lib/healthety/transmission.rb
healthety-0.0.2 lib/healthety/transmission.rb