summaryrefslogtreecommitdiff
path: root/lib/oxidized/input/telnet.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/input/telnet.rb')
-rw-r--r--lib/oxidized/input/telnet.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb
index 13fccf7..bf0140c 100644
--- a/lib/oxidized/input/telnet.rb
+++ b/lib/oxidized/input/telnet.rb
@@ -10,14 +10,19 @@ module Oxidized
@node = node
@timeout = CFG.timeout
@node.model.cfg['telnet'].each { |cb| instance_exec(&cb) }
+ port = vars(:telnet_port) || 23
- opt = { 'Host' => @node.ip, 'Timeout' => @timeout,
- 'Model' => @node.model }
- opt['Output_log'] = CFG.input.debug?.to_s + '-telnet' if CFG.input.debug?
+ opt = { 'Host' => @node.ip,
+ 'Port' => port.to_i,
+ 'Timeout' => @timeout,
+ 'Model' => @node.model }
+ opt['Output_log'] = Oxidized::Config::Crash + "-#{@node.ip}-telnet" if CFG.input.debug?
@telnet = Net::Telnet.new opt
- expect username
- @telnet.puts @node.auth[:username]
+ if @node.auth[:username] and @node.auth[:username].length > 0
+ expect username
+ @telnet.puts @node.auth[:username]
+ end
expect password
@telnet.puts @node.auth[:password]
begin