08-11-2010 03:58 PM
Hi -
As part of my monitoring solution, I have scheduled scripts running on my routers to do various tasks, now I am trying to do trace route to about 10 routers from a seed router to track the path of the trace and if it changes i would be alerted.
What I am having difficulty is doing one trace commands from a text file. Example follows:
Trace 10.10.10.1
Trace 10.20.10.1
Trace 10.30.10.1
The command will stop right after the first line, is there a way in IOS to do a “wait” statement between each command to get this going?
Regards
Daya Rajaratnam
08-11-2010 11:31 PM
You can use Tcl for this. With Tcl, you can use the "after" command to insert a delay between each command:
trace 10.10.10.1
after 3000
trace 10.20.10.1
after 3000
trace 10.30.10.1
That will add a 3 second delay between each command.
08-15-2010 01:24 PM
Great Thank Joseph -
Some of the limitation I have with TCL is it requires IOS 12.3.2 train or higher and also I believe you need to be in enable mode?
08-15-2010 01:55 PM
Correct, you need 12.3(2)T or higher (for router IOS). Tcl is also available in many other non-router platforms. Yes, you do need to be enabled. for tclsh. For EEM, though, you do not need to be enabled. You can register an EEM policy, then anyone on the box can execute it. EEM is also built around Tcl, so the same code could be added to such a policy. For example:
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
array set cliarr [cli_open]
set output {}
foreach host [list x.x.x.x y.y.y.y z.z.z.z] {
append output [cli_exec $cliarr(fd) "traceroute $host"]
after 3000
}
cli_close $cliarr(fd) $cliarr(tty_id)
puts $output
EEM Tcl policies require 12.3(14)T or higher for router IOS.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide