summaryrefslogtreecommitdiff
path: root/lib/oxidized/input/telnet.rb
diff options
context:
space:
mode:
authorReinier Schoof <reinier@skoef.nl>2015-09-25 09:04:13 +0200
committerReinier Schoof <reinier@skoef.nl>2015-09-25 09:04:13 +0200
commitca67e3c67d155ef89eef3add951c4ee010d84f3f (patch)
tree858aa218f34cf66da0a70a738702064c84de6295 /lib/oxidized/input/telnet.rb
parent3734e611373413c3878628ff8a8d07ab93cc2b57 (diff)
only send username when username is set at all
Some of my switches don’t expect any username on telnet. This change allows me to leave the username field effectively empty for a switch.
Diffstat (limited to 'lib/oxidized/input/telnet.rb')
-rw-r--r--lib/oxidized/input/telnet.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb
index d305fcd..f8adb4f 100644
--- a/lib/oxidized/input/telnet.rb
+++ b/lib/oxidized/input/telnet.rb
@@ -19,8 +19,10 @@ module Oxidized
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]
+ if !@node.auth[:username].nil? and @node.auth[:username].length > 0
+ expect username
+ @telnet.puts @node.auth[:username]
+ end
expect password
@telnet.puts @node.auth[:password]
begin