cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
172080
Views
44
Helpful
29
Replies

Script to automate tasks

perpaal
Level 1
Level 1

Hi

I`m looking to automate some functions in a web application.

Functions like enable/disable interfaces on a Cisco 3550 switch.

Anybody know if there are some good scrips, or examples anywhere to get me started?

29 Replies 29

thank you very much Jon, you helped me a lot!!!! 

I{ll keep looking and testing.

Thanks again!

hi

i am not that doog a scripting but part "while read  ipadd" in the ssh.sh file isn´t working for me.

 

This Script worked very well, Thanks for that :)

 

in this script what should i add, so that it asks confirmation before proceeding to next router. like YES or NO prompt.

Hi,

I have been asked to take the capture of command "sh int des | i up" from a list of 494 cisco switches!

 

Is there a way to ssh into all these 494 devices and then have the output of each device captured in a separate file, ideally by the switch hostname?

 

Any help in this matter will be really appreciated.

Thanks.

how did you run it what are the setups and connection to the cisco devices and the computer?please help me.

Hi,I

I want to know that, before running the script how should I connect the PC and cisco switch (either through the console or ethernet port) and any other setups needed on the PC.

how the script communicate with the switch?

PC must be on the same network that Switch, Routers, etc. Connect PC via ethernet cable to Swith where the other equipments are. Are you using Linux or Windows??

I'm Linux user...

follow the answer posted by siddhartham that's marked as the correct answer. It's very simple.

In linux you have to install expect and create the files in the main directoy....simple as that. Just keep in mind that you need to modify the script according to yor needs.

Thank you so much for your responses.i will try with your tips. 

I have both .tell me for both.

jorge vinueza
Level 1
Level 1

hi, thanks for the example, it works fine but how can i execute commans that needs an input like this one:

        send "crypto key generate rsa\r"
        expect "Do you really want to replace them? [yes/no]:"
        send "y\r"
        expect "*[512]:"

i get this error:

sw3-foptop(config)#invalid command name "yes/no"
    while executing
"yes/no"
    invoked from within
"expect "% Do you really want to replace them? [yes/no]:""

When attempting to run these scripts, I'm getting an error that says:

can't read "tr": no such variable
    while executing
"set Password "@dm1n$tr@t0r!""
    (file "./show-run.sh" line 9)

It looks like the expect library can't handle $ for passwords. Does anyone have any suggestions here?

franklaszlo
Level 1
Level 1

I use Script N'Go to script devices. For simple tasks I create a CLI script, but if some logic is required I either build a Python script or create a Visual Script.

dazenfomice
Level 1
Level 1

That really helped me a lot.

I also found a example for backing up config via TFTP that worked great.

Do you know any other resources with more examples, example enable, disable interfaces etc and many more?

Review Cisco Networking for a $25 gift card