/usr/lib/ruby/vendor_ruby/influxdb/writer/udp.rb is in ruby-influxdb 0.2.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | module InfluxDB
module Writer
# Writes data to InfluxDB through UDP
class UDP
attr_accessor :socket
attr_reader :host, :port
def initialize(client, config)
@client = client
config = config.is_a?(Hash) ? config : {}
@host = config.fetch(:host, 'localhost')
@port = config.fetch(:port, 4444)
self.socket = UDPSocket.new
socket.connect(host, port)
end
def write(payload, _precision = nil, _retention_policy = nil)
socket.send(payload, 0)
end
end
end
end
|