cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
906
Views
10
Helpful
2
Replies

How to automatize a specific task by using a script type procedure !!!

Fernando_Meza
Level 7
Level 7

Hi Netpros,

Ideally what I am trying to do is to collect interface stats periodically and damp that info in to a file which can then be reviewed later at the end of the day.

The 'script' pseudo code will look something like this:

1.- At a specific time, from a management PC start a ssh session to router A

2.- perform some specific commands

3.- dump the output in to file A.txt (if the file already exist, then add that information to the existing file and save the changes.

4.- finish the session

5.- After specific time .. go back to point 1.

How can I do this without using management tools such as LMS .. etc.

Your feedback is much appreciated.

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Depending on the version of IOS on this device, you could script this entirely on the router using either TCL+kron or the Embedded Event Manager. You could then have the router keep this data in flash, or transfer it to a network server. For details on TCL in IOS can be found at http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_feature_guide09186a00801a75a7.html and EEM details can be found at http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_chapter09186a00807c676c.html .

If you wanted to use an external management machine, and you need to use SSH, your best bet is to go with Expect as there aren't too many good SSH scripting libraries. See http://expect.nist.gov/ for more details on expect.

For scheduling this to happen on Windows, look at using "at" (the command scheduler). For UNIX, you can use cron.

View solution in original post

2 Replies 2

Joe Clarke
Cisco Employee
Cisco Employee

Depending on the version of IOS on this device, you could script this entirely on the router using either TCL+kron or the Embedded Event Manager. You could then have the router keep this data in flash, or transfer it to a network server. For details on TCL in IOS can be found at http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_feature_guide09186a00801a75a7.html and EEM details can be found at http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_chapter09186a00807c676c.html .

If you wanted to use an external management machine, and you need to use SSH, your best bet is to go with Expect as there aren't too many good SSH scripting libraries. See http://expect.nist.gov/ for more details on expect.

For scheduling this to happen on Windows, look at using "at" (the command scheduler). For UNIX, you can use cron.

Great .. Appreciate your comments .. I will definitely have a look at your links ...

Cheers