Only getting partial results
Hello,
We setted-up an oxidized instance to work with ~20 switchs, everything is working great except on an SG350X switch. We configured a custom ruby model for this switch :
class CiscoSMBcustom < Oxidized::Model
using Refinements
# Cisco Small Business 300, 500, and ESW2 series switches
# http://www.cisco.com/c/en/us/support/switches/small-business-300-series-managed-switches/products-release-notes-list.html
prompt /^\r?([\w.@()-]+[#>]\s?)$/
cmd 'show vlan' do |cfg|
cfg.insert(0,"▬▬ι═══════ﺤ Interfaces VLAN -═══════ι▬▬\n")
cfg
cfg.cut_tail(1)
end
cmd 'show startup-config' do |cfg|
cfg.insert(0,"\n\n▬▬ι═════════ﺤ Full Config -═════════ι▬▬\n")
cfg
cfg.cut_tail(1)
end
cfg :telnet, :ssh do
username /User ?[nN]ame:/
password /^\r?Password:/
post_login do
if vars(:enable) == true
cmd 'enable'
elsif vars(:enable)
cmd 'enable', /^\r?Password:$/
cmd vars(:enable)
end
end
post_login 'terminal datadump' # Disable pager
post_login 'terminal width 0'
pre_logout 'exit' # exit returns to previous priv level, no way to quit from exec(#)
end
end
The problem is that oxidized is getting timedout during the export of the configuration, after "show startup-config". It stops randomly after 50-200 lines of conf.
Some additionnal informations :
- [x] When i log in SSH directly to the switch and type all the commands from our ruby file, everything is working fine.
- [x] The service account have all necessary permissions.
- [x] Oxidized version : 0.29.1
- [x] Rugged version : 1.7.1
- [x] Net-SSH version : 7.2.0
Have a nice day ! LaKishta
You may hit the "timeout" value of the connection. Did you check the logs? Did you try to increase "timeout:" value in Oxidized config?
Usually partial results are because early detection of prompt, due to too permissive regexp.
If you are using SSH, you might want to try set exec mode for ssh, in which case you don't rely on prompt detection at all.