07-28-2017 07:01 PM
How can I take the following tcl and with EEM schedule it so the router pings the list of IP addresses every 2, 6, 8, or 24 hours?
router# tclsh
router(tcl)#foreach address {
10.x.x.201
10.x.x.201
10.x.x.202
10.x.x.203
10.x.x.204
10.x.x.205
10.x.x.206
10.x.x.207
10.x.x.208
10.x.x.209
10.x.x.210
10.x.x.211
10.x.x.212
} {
ping $address
}
07-30-2017 09:46 AM
You don't need Tcl to do this. You could do it with an applet:
event manager environment addresses 10.x.x.201 ... 10.x.x.212
!
event manager applet ping-addrs
event timer cron cron-entry "0 0,2,8,16 * * *"
action 1.0 cli command "enable"
action 2.0 foreach addr $addresses
action 3.0 cli command "ping $addr"
action 4.0 end
07-31-2017 12:05 PM
How do I know this works? When I run the TCLSH I can see the output on the screen that the pings are successful. How do I verify that the event manager applet is successful?
07-31-2017 12:10 PM
It depends on how you want the output. You can send it via syslog by adding:
action 3.1 syslog msg "$_cli_result"
Or create an email with:
action 1.1 set results ""
action 3.1 append results $_cli_result
action 4.1 mail to "user@company.com" from "user@company.com" server "10.1.1.1" subject "Ping Results" body "$results"
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