Output of show tech-support on Cisco devices
See original GitHub issueHello @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:
- Created 2 years ago
- Comments:39 (22 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it is fixed in 4.x
Thank you Osama Abbas
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