Class: Oxidized::Exec

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

Constant Summary

Constants inherited from Input

Input::RESCUE_FAIL

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(cmd_str) ⇒ Object



13
14
15
16
17
18
# File 'lib/oxidized/input/exec.rb', line 13

def cmd(cmd_str)
  Oxidized.logger.debug "EXEC: #{cmd_str} @ #{@node.name}"
  # I'd really like to do popen3 with separate arguments, but that would
  # require refactoring cmd to take parameters
  %x(#{cmd_str})
end

#connect(node) ⇒ Object



7
8
9
10
11
# File 'lib/oxidized/input/exec.rb', line 7

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