I'm trying to create a TCL script that will run automatically when it sees a specific log message. Once that syslog message appears it should then send pings to a couple of addresses(as well as grab output of show ip eigrp neighbrs) and save the output to a file on bootflash:
I found an example of how to store the output of the pings but i am not sure on 2 things.
1. How do i store the output of show ip eigrp neighbors to teh same ping file
2. how do i get the script to trigger on the following syslog message: %DUAL-5-NBRCHANGE
3. Also would it be possible to have this run a few times and to keep appending to the same file so that each time eigrp flaps, we don't delete what was in the ping file from the previous flap?
Here is the code i have currently
set fd [open "bootdisk:ping.txt" w]
foreach address {192.168.1.1 224.0.0.10} {
set output [exec "ping $address repeat 5 source g0/0/0 timeout 1"]
puts $fd $output
}
foreach address {192.168.1.2 224.0.0.10} {
set output [exec "ping $address repeat 5 source g1/0/0 timeout 1"]
puts $fd $output
}
exec show ip eigrp neighbors <<<<<<<<<<<<< how do i store the output of this command to the same ping file.
close $fd