+ Reply to Thread
Results 1 to 18 of 18
  1. Senior Member
    Join Date
    Dec 2014
    Posts
    292
    #1

    Default How To Run Scripts To Execute a Series of show command

    Hi,

    Is there a way to run:

    show run
    show inventory
    show version

    on a series of routers using an automated script?
    Reply With Quote Quote  

  2. SS
  3. Senior Member dontstop's Avatar
    Join Date
    Dec 2011
    Location
    ::1/128
    Posts
    558

    Certifications
    CompTIA IT Fundamentals, CCENT, CCNA:R&S, JNCIA, BInfoTech
    #2
    You should check out the expect command using SSH

    https://www.linkedin.com/pulse/simpl...iel-gilbertson
    Reply With Quote Quote  

  4. Member
    Join Date
    Nov 2016
    Posts
    53
    #3

    Default Cisco EEM

    Cisco EEM (http://www.cisco.com/c/en/us/product...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
    }


    Last edited by txn41655; 03-09-2017 at 05:03 AM.
    Reply With Quote Quote  

  5. Senior Member
    Join Date
    Oct 2013
    Posts
    1,145

    Certifications
    RHCE
    #4
    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...nd_module.html
    Reply With Quote Quote  

  6. Senior Member
    Join Date
    Dec 2014
    Posts
    292
    #5
    Quote Originally Posted by txn41655 View Post
    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?

    Quote Originally Posted by txn41655 View Post
    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?
    Reply With Quote Quote  

  7. Member
    Join Date
    Oct 2016
    Posts
    45

    Certifications
    CCNA R&S, BS: Computer Science
    #6
    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.
    Last edited by Uriah7; 03-12-2017 at 04:11 PM.
    Reply With Quote Quote  

  8. Member
    Join Date
    Nov 2016
    Posts
    53
    #7
    Quote Originally Posted by dppagc View Post
    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
    Reply With Quote Quote  

  9. Senior Member
    Join Date
    Dec 2014
    Posts
    292
    #8
    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.
    Reply With Quote Quote  

  10. Senior Member
    Join Date
    Dec 2014
    Posts
    292
    #9
    Quote Originally Posted by Uriah7 View Post
    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!
    Reply With Quote Quote  

  11. Senior Member
    Join Date
    Apr 2015
    Posts
    759

    Certifications
    CCNA R&S, Security+, Network+, Linux+, Linux Essentials
    #10
    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.
    Reply With Quote Quote  

  12. Senior Member
    Join Date
    Dec 2014
    Posts
    292
    #11
    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.
    Reply With Quote Quote  

  13. Senior Member
    Join Date
    Apr 2015
    Posts
    759

    Certifications
    CCNA R&S, Security+, Network+, Linux+, Linux Essentials
    #12
    You hvae to type "term shell" first. If your IOS code supports it the rest of the commands will work.
    Reply With Quote Quote  

  14. Junior Member Registered Member
    Join Date
    Mar 2017
    Posts
    4
    #13
    Thanks! Soy usefull!!!
    Reply With Quote Quote  

  15. Senior Member
    Join Date
    Dec 2014
    Posts
    292
    #14
    Is the term shell command in config mode or privileged mode?
    Or is it because I am using Nexus OS so it doesnt accept?
    Reply With Quote Quote  

  16. No longer active.
    Join Date
    Jul 2016
    Posts
    413
    #15
    Quote Originally Posted by dppagc View Post
    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 [Cisco IOS Shell Configuration Guide, Cisco IOS Release 15.1M - Cisco IOS Shell [Support] - Cisco] of use.
    Reply With Quote Quote  

  17. Senior Member
    Join Date
    Dec 2014
    Posts
    292
    #16
    Quote Originally Posted by dppagc View Post
    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?
    Reply With Quote Quote  

  18. Senior Member
    Join Date
    Dec 2014
    Posts
    292
    #17
    Hi I still have to putty in manually and also save the file to desktop manually. Any suggestions?
    Reply With Quote Quote  

  19. Member willieb's Avatar
    Join Date
    Aug 2016
    Location
    Southeast GA, USA
    Posts
    79

    Certifications
    CCENT, CCNA R&S, Calix Ethernet Access Network Specialist, Calix E7 Active Ethernet Specialist, Calix E7 GPON Specialist, Expired: CCNP, CCAI
    #18
    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
    Reply With Quote Quote  

+ Reply to Thread

Social Networking & Bookmarks