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

Answered Question
May 9th, 2007
User Badges:
  • Gold, 750 points or more

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.



Correct Answer by Joe Clarke about 9 years 11 months ago

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (3 ratings)
Loading.
Correct Answer
Joe Clarke Wed, 05/09/2007 - 17:44
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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.

Fernando_Meza Sat, 05/12/2007 - 02:23
User Badges:
  • Gold, 750 points or more

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


Cheers



Actions

This Discussion