class Oxidized::TFTP

Public Instance Methods

cmd(file) click to toggle source
# File lib/oxidized/input/tftp.rb, line 23
def cmd(file)
  Oxidized.logger.debug "TFTP: #{file} @ #{@node.name}"
  config = StringIO.new
  @tftp.getbinary file, config
  config.rewind
  config.read
end
connect(node) click to toggle source

TFTP utilizes UDP, there is not a connection. We simply specify an IP and send/receive data.

# File lib/oxidized/input/tftp.rb, line 15
def connect(node)
  @node = node

  @node.model.cfg['tftp'].each { |cb| instance_exec(&cb) }
  @log = File.open(Oxidized::Config::LOG + "/#{@node.ip}-tftp", 'w') if Oxidized.config.input.debug?
  @tftp = Net::TFTP.new @node.ip
end

Private Instance Methods

disconnect() click to toggle source
# File lib/oxidized/input/tftp.rb, line 33
def disconnect
  # TFTP uses UDP, there is no connection to close
  true
ensure
  @log.close if Oxidized.config.input.debug?
end