diff options
| author | MrRJ45 <couton@gmail.com> | 2015-08-15 08:13:58 +0100 | 
|---|---|---|
| committer | MrRJ45 <couton@gmail.com> | 2015-08-15 08:13:58 +0100 | 
| commit | 2216e945ae4ff51904f13cc2387507cf690de8c2 (patch) | |
| tree | 3cd43b0a673068577a24788b5d75b1d6a3ee9ab2 /lib/oxidized | |
| parent | 5f892762c05e425f8d4d0d8b36371ed0e9114ca2 (diff) | |
Update routeros.rb
Fix Prompt as RouterOS seems to send a lot of rubbish (at least using Telnet)
Add support for Telnet on RouterOS. Strip any colours from the output also.
Diffstat (limited to 'lib/oxidized')
| -rw-r--r-- | lib/oxidized/model/routeros.rb | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/lib/oxidized/model/routeros.rb b/lib/oxidized/model/routeros.rb index bd588b7..3ee40fc 100644 --- a/lib/oxidized/model/routeros.rb +++ b/lib/oxidized/model/routeros.rb @@ -1,5 +1,5 @@  class RouterOS < Oxidized::Model -  prompt /^\[\w+@\S+\]\s?>\s?$/ +  prompt /\[\w+@\S+\]\s?>\s?$/    comment "# "    cmd '/system routerboard print' do |cfg| @@ -7,10 +7,16 @@ class RouterOS < Oxidized::Model    end    cmd '/export' do |cfg| +    cfg.gsub! /\[(?:\d+)?(?:;\d+)?(?:m)?/, '' # strip ANSI colours      cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }      cfg.join("\n") + "\n"    end +  cfg :telnet do +    username /^Login:/ +    password /^Password:/ +  end +    cfg :ssh do      exec true    end | 
