diff options
author | Saku Ytti <saku@ytti.fi> | 2014-04-13 10:45:36 +0300 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-04-13 10:45:36 +0300 |
commit | b603c20370c7548739f90f2b92ffa066d59446ab (patch) | |
tree | a14f062b34df21caa6a29edea265109acf7e639c /lib/oxidized/input/telnet.rb | |
parent | 8cf98a934f42bea096538ae41afa6055a35c0479 (diff) |
smarter match for IP address in nodes
- add 'connnected?' method to ssh/telnet to query if or not we're
connected
- subclass OxidizedError from StandardError, all future OxidizedErrors
should be subclasssed from this.
Diffstat (limited to 'lib/oxidized/input/telnet.rb')
-rw-r--r-- | lib/oxidized/input/telnet.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 } |