Options

How To Run Scripts To Execute a Series of show command

dppagcdppagc Member Posts: 293
Hi,

Is there a way to run:

show run
show inventory
show version

on a series of routers using an automated script?

Comments

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


  • Options
    VeritiesVerities Member Posts: 1,162
    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
  • Options
    dppagcdppagc Member Posts: 293
    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?
  • Options
    Uriah7Uriah7 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.
  • Options
    txn41655txn41655 Member Posts: 53 ■■□□□□□□□□
    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
  • Options
    dppagcdppagc Member Posts: 293
    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.
  • Options
    dppagcdppagc Member Posts: 293
    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!
  • Options
    thomas_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.
  • Options
    dppagcdppagc Member Posts: 293
    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.
  • Options
    thomas_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.
  • Options
    737jessica737jessica Registered Users Posts: 4 ■□□□□□□□□□
    Thanks! Soy usefull!!!
  • Options
    dppagcdppagc Member Posts: 293
    Is the term shell command in config mode or privileged mode?
    Or is it because I am using Nexus OS so it doesnt accept?
  • Options
    rob42rob42 Member Posts: 423
    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
  • Options
    dppagcdppagc Member Posts: 293
    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?
  • Options
    dppagcdppagc Member Posts: 293
    Hi I still have to putty in manually and also save the file to desktop manually. Any suggestions?
  • Options
    williebwillieb 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
Sign In or Register to comment.