diff options
Diffstat (limited to 'lib/oxidized/input')
-rw-r--r-- | lib/oxidized/input/ssh.rb | 4 | ||||
-rw-r--r-- | lib/oxidized/input/telnet.rb | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index a858213..bd0a459 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -27,6 +27,10 @@ module Oxidized shell_open @ssh @username ? shell_login : expect(@node.prompt) end + connected? + end + + def connected? @ssh and not @ssh.closed? end diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb index 84d9877..4e80ceb 100644 --- a/lib/oxidized/input/telnet.rb +++ b/lib/oxidized/input/telnet.rb @@ -19,6 +19,10 @@ module Oxidized expect @node.prompt end + def connected? + @telnet and not @telnet.sock.closed? + end + def cmd cmd, expect=@node.prompt Log.debug "Telnet: #{cmd} @#{@node.name}" args = { 'String' => cmd } |