How To Run Scripts To Execute a Series of show command
dppagc
Member Posts: 293
in CCNA & CCENT
Hi,
Is there a way to run:
show run
show inventory
show version
on a series of routers using an automated script?
Is there a way to run:
show run
show inventory
show version
on a series of routers using an automated script?
Comments
-
dontstop Member Posts: 579 ■■■■□□□□□□You should check out the expect command using SSH
https://www.linkedin.com/pulse/simple-bash-scripts-using-expect-cisco-devices-daniel-gilbertson -
txn41655 Member Posts: 53 ■■□□□□□□□□Cisco EEM (http://www.cisco.com/c/en/us/products/ios-nx-os-software/ios-embedded-event-manager-eem/index.html)
or
write those commands in notepad then "copy & paste" to routers ?
or
TCLSH ?
foreach address {
x.x.x.x
x.x.x.x
x.x.x.x} { ping $address
}
-
Verities Member Posts: 1,162Ansible is another option; once you have it setup you can remotely control all your devices (also uses SSH):
https://docs.ansible.com/ansible/ios_command_module.html -
dppagc Member Posts: 293Cisco EEM (Cisco IOS Embedded Event Manager (EEM) - Cisco)
or
write those commands in notepad then "copy & paste" to routers ?TCLSH ?
foreach address {
x.x.x.x
x.x.x.x
x.x.x.x} { ping $address
}
I am not doing ping command. I am doing show commands. Any demonstration? -
Uriah7 Member Posts: 45 ■■□□□□□□□□How are you connecting to said equipment? Console, ssh, telnet, etc?
What Operating System are you using to access your equipment? Windows?
If you let me know, I can help you write a script. -
txn41655 Member Posts: 53 ■■□□□□□□□□I have to wait for one output to finish before I execute the next command. Is there a shortcut?
I am not doing ping command. I am doing show commands. Any demonstration?
you asked about script, why don't you start learning script? here is the tutorial :
https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html -
dppagc Member Posts: 293Any video demostration of what I need. The tcl script is over what I need. I just need a simple script that will run the various commands after the previous output is finished.
-
dppagc Member Posts: 293How are you connecting to said equipment? Console, ssh, telnet, etc?
What Operating System are you using to access your equipment? Windows?
If you let me know, I can help you write a script.
I can telnet/ssh to the equipment using putty.I am using windows.
I would like a sample script on 1 router first.
I would like to test it.
Thank you! -
thomas_ Member Posts: 1,012 ■■■■■■■■□□term sh
function dppagc () {
show run
show inventory
show version
}
Then type "dppagc" at the command prompt. This may or may not work depending on what version of code you are running. You would have to create that function on each router you wanted to run it on. If you're looking to run it on a series of routers, then Pynet might be a good option. -
dppagc Member Posts: 293hi thomas, it doesnt work
after i enter my login and password, it does not recognise function dppagc () .
What is the step I do after
login: myname
Password: cisco
Router#
what do I do next??
If i type in sh run, sh ip int br, ...
The sh ip int br will become truncated to br.
This is what I am facing. -
thomas_ Member Posts: 1,012 ■■■■■■■■□□You hvae to type "term shell" first. If your IOS code supports it the rest of the commands will work.
-
dppagc Member Posts: 293Is the term shell command in config mode or privileged mode?
Or is it because I am using Nexus OS so it doesnt accept? -
rob42 Member Posts: 423Is the term shell command in config mode or privileged mode?
Or is it because I am using Nexus OS so it doesnt accept?No longer an active member -
dppagc Member Posts: 293Hi,
Is there a way to run:
show run
show inventory
show version
on a series of routers using an automated script?
Hi any EEM script for this? -
dppagc Member Posts: 293Hi I still have to putty in manually and also save the file to desktop manually. Any suggestions?
-
willieb Member Posts: 108 ■■■□□□□□□□Don't how me exactly how because I'd have to research it, but I'm pretty sure this also can be done in TeraTerm using Macro Scripting with LogMeTT.[X] CCENT ICND1 100-105
[X] CCNA ICND2 200-105
[X] CCNP ROUTE 300-101
[X] CCNP SWITCH 300-115
[X] CCNP TSHOOT 300-135
[ ] CCDP ARCH 300-320