summaryrefslogtreecommitdiff
path: root/lib/oxidized/input/telnet.rb
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-08-08 21:25:18 +0300
committerSaku Ytti <saku@ytti.fi>2014-08-08 21:25:18 +0300
commit96d6c0213178241ab3170141906c152c6984e446 (patch)
treedc5168d8dd2beebba56e4c9b9131da173727ce40 /lib/oxidized/input/telnet.rb
parenta2df4cabc72383936f215b766311b159e6800a17 (diff)
Support creating session log of telnet/ssh
If you have input: debug: session_log Then session_log-telnet and session_log-ssh will be created showing what the telnet/ssh saw. Helpful in model development.
Diffstat (limited to 'lib/oxidized/input/telnet.rb')
-rw-r--r--lib/oxidized/input/telnet.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb
index d52ebf0..62f361e 100644
--- a/lib/oxidized/input/telnet.rb
+++ b/lib/oxidized/input/telnet.rb
@@ -10,8 +10,12 @@ module Oxidized
@node = node
@timeout = CFG.timeout
@node.model.cfg['telnet'].each { |cb| instance_exec(&cb) }
- @telnet = Net::Telnet.new 'Host' => @node.ip, 'Timeout' => @timeout,
- 'Model' => @node.model
+
+ opt = { 'Host' => @node.ip, 'Timeout' => @timeout,
+ 'Model' => @node.model }
+ opt['Output_log'] = CFG.input.debug?.to_s + '-telnet' if CFG.input.debug?
+
+ @telnet = Net::Telnet.new opt
expect username
@telnet.puts @node.auth[:username]
expect password