Class: Oxidized::SCP

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

Constant Summary collapse

RESCUE_FAIL =
{
  debug: [
    # Net::SSH::Disconnect,
  ],
  warn:  [
    # RuntimeError,
    # Net::SSH::AuthenticationFailed,
  ]
}.freeze

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



31
32
33
34
# File 'lib/oxidized/input/scp.rb', line 31

def cmd(file)
  Oxidized.logger.debug "SCP: #{file} @ #{@node.name}"
  @ssh.scp.download!(file)
end

#connect(node) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/oxidized/input/scp.rb', line 19

def connect(node)
  @node = node
  @node.model.cfg['scp'].each { |cb| instance_exec(&cb) }
  @log = File.open(Oxidized::Config::LOG + "/#{@node.ip}-scp", 'w') if Oxidized.config.input.debug?
  @ssh = Net::SSH.start(@node.ip, @node.auth[:username], password: @node.auth[:password])
  connected?
end

#connected?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/oxidized/input/scp.rb', line 27

def connected?
  @ssh && (not @ssh.closed?)
end

#outputObject



40
41
42
# File 'lib/oxidized/input/scp.rb', line 40

def output
  ""
end

#send(my_proc) ⇒ Object



36
37
38
# File 'lib/oxidized/input/scp.rb', line 36

def send(my_proc)
  my_proc.call
end