diff options
author | Saku Ytti <saku@ytti.fi> | 2014-03-01 11:35:17 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-03-01 11:35:17 +0200 |
commit | 7c2565720c898b0573a5a30db958d8a78577f4a4 (patch) | |
tree | 525994271e0b6685439d1c2e12d64a98ed6e69a7 /lib/oxidized/input/telnet.rb | |
parent | b0c6086256522ad1a7403937968184cab7f89d0c (diff) |
Add Model#output method
Outputs about what we've seen last in input class. Quite dirty in
telnet, so not sure I'm going to support it. Let's see if there is
use-case for it.
Diffstat (limited to 'lib/oxidized/input/telnet.rb')
-rw-r--r-- | lib/oxidized/input/telnet.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb index 31ed8d0..26df113 100644 --- a/lib/oxidized/input/telnet.rb +++ b/lib/oxidized/input/telnet.rb @@ -9,7 +9,7 @@ module Oxidized def connect node @node = node @timeout = CFG.timeout - @node.model.cfg['telnet'].each { |cb| instance_exec &cb } + @node.model.cfg['telnet'].each { |cb| instance_exec(&cb) } @telnet = Net::Telnet.new 'Host' => @node.ip, 'Waittime' => @timeout, 'Model' => @node.model expect username @@ -30,6 +30,10 @@ module Oxidized @telnet.write data end + def output + @telnet.output + end + private def expect re @@ -59,6 +63,8 @@ end class Net::Telnet ## FIXME: we just need 'line = model.expects line' to handle pager ## how to do this, without redefining the whole damn thing + ## FIXME: we also need output (not sure I'm going to support this) + attr_reader :output def waitfor(options) # :yield: recvdata time_out = @options["Timeout"] waittime = @options["Waittime"] @@ -93,6 +99,7 @@ class Net::Telnet end begin c = @sock.readpartial(1024 * 1024) + @output = c @dumplog.log_dump('<', c) if @options.has_key?("Dump_log") if @options["Telnetmode"] c = rest + c |