Class: Oxidized::TFTP

Inherits:
Input
  • Object
show all
Includes:
Input::CLI
Defined in:
lib/oxidized/input/tftp.rb

Constant Summary

Constants inherited from Input

Input::RescueFail

Instance Attribute Summary

Attributes included from Input::CLI

#node

Instance Method Summary collapse

Methods included from Input::CLI

#connect_cli, #disconnect_cli, #get, #initialize, #login, #password, #post_login, #pre_logout, #username

Methods included from Config::Vars

#vars

Instance Method Details

#cmd(file) ⇒ Object



23
24
25
26
27
28
29
# 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) ⇒ Object

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



15
16
17
18
19
20
21
# 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