question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

send command "copy running-config tftp:\n %s\n\r" % Tftp_server"

See original GitHub issue

Dear all,

I used the following lines to backup a configuration from cisco sw to a tftp server

        net_connect = ConnectHandler(**LoginInfo)
        net_connect.enable()
        command_ConfSave="copy running-config tftp:\n %s\n\r" % Tftp_server
        result=net_connect.send_command_expect(command_ConfSave)

it works with Catalyst switch, but when with Nexus, always facing an error as following Exception in thread Thread-2:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Program Files (x86)\Python36-32\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Temp\workspace\Production\SWlogin\ExcuteCommandOnSW.py", line 61, in BBakC
    result=net_connect.send_command_expect(command_ConfSave)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\netmiko\base_connection.py", line 823, in send_command_expect
    return self.send_command(*args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\netmiko\base_connection.py", line 815, in send_command
    search_pattern))

seems the interaction between the netmiko and switch had an error, can not “#” from switch

Catalyst version 15.0(1)SE3 Nexus version 6.0(2)N2(2) Netmiko 1.4.1

My question: is there some way can help to see the realtime output from this ssh session? it may help to do some more trouble shooting on it

thanks a lot

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bosspujcommented, Feb 28, 2018

@ktbyers Thanks for the help! Much appreciated!

0reactions
ktbyerscommented, Feb 28, 2018

Probably try:

    connection.send_command('copy ftp://username:pass@internal_ip/%s %s:/'%(suitable_img_file, directory), delay_factor=4)

Note, by default send_command will wait 100 seconds, so delay_factor=4 will wait 400 seconds. If you need longer than this, you can increase it to a bigger value.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I copy config to TFTP? - Cisco Community
The first, You should check your NVRAM or you have to find where start-config.cfe is being. please type the command:dir all: and then...
Read more >
Copying a configuration file to or from a TFTP server
To initiate transfers of configuration files to or from a TFTP server using the CLI, enter one of the following commands: copy startup-config ......
Read more >
Copying a configuration file to or from a TFTP server
To initiate transfers of configuration files to or from a TFTP server using the CLI, enter one of the following commands: copy startup-config...
Read more >
Schedule Cisco config backups with kron and archive - YouTube
With just a few CLI commands you can automate the backup of your Cisco networks. Use Kron and archive to back up configs...
Read more >
Transferring switch configurations
This command can copy a designated config file in the switch to a TFTP server. For more information, see "Multiple Configuration Files" in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found