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.

Output of show tech-support on Cisco devices

See original GitHub issue

Hello @ktbyers,

I was wondering what is the right way of getting show tech-support command output from multiple Cisco devices. This output takes from 20-30 minutes depending on many factors (Number of switches in a stack, IOS version, etc.). There is no room for tries as you cannot stop the output. CTRL+C/CTRL+Z/CTRL+SHIFT+6 has no effect on stopping the output from being displayed.

My Code is:

#!usr/bin python3

from netmiko import ConnectHandler

ipaddrs = ["", "", "", "", ""]

devices = []
for ip in ipaddrs:
    devices.append(
        {
            "device_type": "cisco_ios_telnet",
            "ip": ip,
            "username": "cisco",
            "password": "cisco",
            "fast_cli": False,
            "conn_timeout": 15,
            "session_log": f"{ip}-session.log",
        }
    )

for device in devices:
    with ConnectHandler(**device) as net_connect:
        print(f'Connected to {device["ip"]}')
        hostname = net_connect.send_command("show version", use_textfsm=True)[0][
            "hostname"
        ]
        tech_support = net_connect.send_command("show tech-support", delay_factor=20)

    with open(f"{hostname}.txt", "w") as outfile:
        outfile.write(tech_support.lstrip())

    print(f'tech support of {device["ip"]} is saved successfully to {hostname}.txt')

print("Done")

Do you think this code will work in normal conditions: The devices are up and running and there are no issues in connecting to the devices?

My actual code has a try/except block for catching errors.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:39 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
Tes3awycommented, Sep 11, 2022

Yes, it is fixed in 4.x

Thank you Osama Abbas

1reaction
ktbyerscommented, Sep 8, 2022

I think this issue is probably fixed in Netmiko version 4.X using the read_timeout argument.

https://pynet.twb-tech.com/blog/netmiko-read-timeout.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tech-Support Commands - Cisco Content Hub
This module describes commands used for displaying the output of show commands using Cisco IOS XR software software. The command output varies depending...
Read more >
Cisco Switches - How to Capture "show tech-support" from CLI
When capturing a show tech-support from CLI, the default mode displays the output one screen at a time and waits for user input....
Read more >
How to Copy Large "Show Tech-support" from Cisco Device ...
Once you are connected to the device. For cisco devices, In the exec-mode of the device prompt, type “show tech-support”. Make sure you...
Read more >
How To Get a "Show-Tech" Output From Putty and SecureCRT
How To Get a " Show -Tech" Output From Putty and SecureCRT. 3.1K views 1 year ago. NetworkBruh. NetworkBruh. 6.2K subscribers. Subscribe.
Read more >
How to generate the show tech log file - NETWORX SECURITY
sh tech is the abbreviation of the show tech command or to be more precise of the show tech-support command. It's executed 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