How To Run Scripts To Execute a Series of show command

dppagcdppagc Posts: 293Member
Hi,

Is there a way to run:

show run
show inventory
show version

on a series of routers using an automated script?

Comments

  • dontstopdontstop Posts: 565Member ■■■■□□□□□□
  • txn41655txn41655 Posts: 53Member ■■□□□□□□□□
    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
    }


  • VeritiesVerities Posts: 1,162Member
    Ansible 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
  • dppagcdppagc Posts: 293Member
    txn41655 wrote: »
    Cisco EEM (Cisco IOS Embedded Event Manager (EEM) - Cisco)

    or

    write those commands in notepad then "copy & paste" to routers ?
    I have to wait for one output to finish before I execute the next command. Is there a shortcut?
    txn41655 wrote: »
    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?
  • Uriah7Uriah7 Posts: 45Member ■■□□□□□□□□
    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.
  • txn41655txn41655 Posts: 53Member ■■□□□□□□□□
    dppagc wrote: »
    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
  • dppagcdppagc Posts: 293Member
    Any 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.
  • dppagcdppagc Posts: 293Member
    Uriah7 wrote: »
    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.

    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_thomas_ Senior Member Posts: 812Member ■■■■□□□□□□
    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.
  • dppagcdppagc Posts: 293Member
    hi 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_thomas_ Senior Member Posts: 812Member ■■■■□□□□□□
    You hvae to type "term shell" first. If your IOS code supports it the rest of the commands will work.
  • 737jessica737jessica Posts: 4Registered Users ■□□□□□□□□□
    Thanks! Soy usefull!!!
  • dppagcdppagc Posts: 293Member
    Is the term shell command in config mode or privileged mode?
    Or is it because I am using Nexus OS so it doesnt accept?
  • rob42rob42 Posts: 423Member
    dppagc wrote: »
    Is the term shell command in config mode or privileged mode?
    Or is it because I am using Nexus OS so it doesnt accept?
    You may find this link url=http://www.cisco.com/c/en/us/td/docs/ios/netmgmt/configuration/guide/Convert/IOS_Shell/nm_ios_shell.html#wp1055390%0A]Cisco IOS Shell Configuration Guide, Cisco IOS Release 15.1M - Cisco IOS Shell [Support] - Cisco[/url of use.
    No longer an active member
  • dppagcdppagc Posts: 293Member
    dppagc wrote: »
    Hi,

    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?
  • dppagcdppagc Posts: 293Member
    Hi I still have to putty in manually and also save the file to desktop manually. Any suggestions?
  • williebwillieb Posts: 100Member ■■■□□□□□□□
    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
    [ ] CCNP Tshoot 300-135
Sign In or Register to comment.