diff options
-rw-r--r-- | extra/rest_client.rb | 4 | ||||
-rw-r--r-- | lib/oxidized/input/ssh.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/input/telnet.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/ios.rb | 14 |
4 files changed, 14 insertions, 8 deletions
diff --git a/extra/rest_client.rb b/extra/rest_client.rb index 88daeae..19f2439 100644 --- a/extra/rest_client.rb +++ b/extra/rest_client.rb @@ -6,9 +6,9 @@ module Oxidized PORT = 8888 class << self - def next node, opt={}, host=HOST, port=PORT + def next opt={}, host=HOST, port=PORT web = new host, port - web.next node, opt + web.next opt end end diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index c0594db..dc90354 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -39,7 +39,7 @@ module Oxidized disconnect_cli @ssh.loop @ssh.close if not @ssh.closed? - rescue Net::SSH::Disconnect + rescue Errno::ECONNRESET, Net::SSH::Disconnect end end diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb index c4c8bab..26755ca 100644 --- a/lib/oxidized/input/telnet.rb +++ b/lib/oxidized/input/telnet.rb @@ -17,7 +17,7 @@ module Oxidized expect password @telnet.puts @node.auth[:password] expect @node.prompt - rescue Timeout::Error, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH + rescue Timeout::Error, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EPIPE, Errno::EHOSTUNREACH return false end end diff --git a/lib/oxidized/model/ios.rb b/lib/oxidized/model/ios.rb index 3fcc7ae..a216126 100644 --- a/lib/oxidized/model/ios.rb +++ b/lib/oxidized/model/ios.rb @@ -23,7 +23,11 @@ class IOS < Oxidized::Model cmd 'show running-config' do |cfg| cfg = cfg.each_line.to_a[3..-1].join + cfg.gsub! /^Current configuration : [^\n]*\n/, '' cfg.sub! /^(ntp clock-period).*/, '! \1' + cfg.gsub! /^\ tunnel\ mpls\ traffic-eng\ bandwidth[^\n]*\n*( + (?:\ [^\n]*\n*)* + tunnel\ mpls\ traffic-eng\ auto-bw)/mx, '\1' cfg end @@ -40,10 +44,12 @@ class IOS < Oxidized::Model post_login 'terminal length 0' post_login 'terminal width 0' # preferred way to handle additional passwords - #post_login do - # send "enable\n" - # send CFG.vars[:enable] + "\n" - #end + if CFG.vars[:enable] and CFG.vars[:enable] != '' + post_login do + send "enable\n" + send CFG.vars[:enable] + "\n" + end + end pre_logout 'exit' end |