Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only getting partial results #2957

Closed
5 tasks done
LaKishta opened this issue Oct 4, 2023 · 2 comments
Closed
5 tasks done

Only getting partial results #2957

LaKishta opened this issue Oct 4, 2023 · 2 comments
Labels

Comments

@LaKishta
Copy link

LaKishta commented Oct 4, 2023

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 :

  • When i log in SSH directly to the switch and type all the commands from our ruby file, everything is working fine.
  • The service account have all necessary permissions.
  • Oxidized version : 0.29.1
  • Rugged version : 1.7.1
  • Net-SSH version : 7.2.0

Have a nice day !
LaKishta

@netdiver
Copy link
Contributor

netdiver commented Mar 7, 2024

You may hit the "timeout" value of the connection.
Did you check the logs?
Did you try to increase "timeout:" value in Oxidized config?

@github-actions github-actions bot added the Stale label Jun 6, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 7, 2024
@ytti
Copy link
Owner

ytti commented Jul 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants