cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1772
Views
0
Helpful
2
Replies

EEM Applet wont fire TCL script after countdown expires

Robert Arellano
Level 1
Level 1

We currently use the below EEM Applet that tracks a BGP route and if that route fails, it begins a 45 min countdown, once that countdown expires, the router reloads. If the BGP route restores it will remove the countdown applet.

I'm trying to modify this applet to mirror the same type of behavior but instead of the reload after 45 minutes, I am trying to modify cellular settings via TCL Script or any other means for that matter.

Is this possible? Can anyone direct me how to accomplish this?

Cisco 1941 Version 15.4(3)M2

event manager applet track-down
description " This applet will add the countdown applet when BGP route to 10.66.66.66 goes down"
event track 10 state down
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet countdown"
action 3.1 cli command "description This applet is the countdown timer and will cause the router to reload after 2700 seconds if BGP route is still down"
action 3.2 cli command "event timer countdown time 2700"
action 3.3 cli command "action 1.0 reload"
action 4.0 cli command "end"
action 4.1 cli command "enable"
action 4.2 cli command " wr mem"
event manager applet track-up
description "This applet will remove the countdown applet when BGP route to 10.66.66.66 restores"
event track 10 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet countdown"
action 4.0 cli command "end"
!

Below is the modified applet I've had the most success with. The issue I'm running into is, its not waiting the 60 seconds(for testing purposes I've reduced it to 1 minute) to execute the tcl script. From my limited understanding, I've discovered that after the event timer countdown - the applet requires an action immediately after but does not accept a cli command such as "tclsh Cell.tcl" as an "action.""

event manager applet track-down
event track 10 state down
action 1.0 cli command "enable"
action 1.1 cli command "config t"
action 1.3 cli command "event manager applet countdown"
action 1.4 cli command "event timer countdown time 30"
action 1.5 cli command "action 1.0 wait 30"
action 1.6 cli command "end"
action 1.7 cli command "tclsh Cell.tcl"
event manager applet track-up
event track 10 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet countdown"
action 4.0 cli command "end"

This is the TCL script I'm using to execute the cellular modifications required.

tclsh
puts [ open "flash:Cell.tcl" w+ ] {
ios_config "interface ce 0/1/0" "shut"
ios_config "cell 0/1/0 lte tech gsm"
ios_config "interface ce 0/1/0" "no shut"
after 10000
ios_config "interface ce 0/1/0" "shut"
ios_config exec "cell 0/1/0 lte tech auto"
ios_config "interface ce 0/1/0" "no shut"
}
tclquit

Thanks,
Robert

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

These applets won't accomplish what you want.  I also never recommend calling tclsh from EEM.  You don't need to do it.  Either use EEM Tcl natively, or in your case, just use pure applets.  Have a look at https://supportforums.cisco.com/document/12723951/how-introduce-large-delays-eem-policies .  If you follow that example and put your config CLI commands in the countdown applet, you will be able to achieve what you want.

View solution in original post

2 Replies 2

Joe Clarke
Cisco Employee
Cisco Employee

These applets won't accomplish what you want.  I also never recommend calling tclsh from EEM.  You don't need to do it.  Either use EEM Tcl natively, or in your case, just use pure applets.  Have a look at https://supportforums.cisco.com/document/12723951/how-introduce-large-delays-eem-policies .  If you follow that example and put your config CLI commands in the countdown applet, you will be able to achieve what you want.

Joe,

Great input! This was exactly what I needed, thank you! I have used your recommendation and have achieved the desired results and behavior!

Review Cisco Networking for a $25 gift card