cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
623
Views
0
Helpful
9
Replies
Beginner

Tcl/EEM with IP SLA tracking down/up

Hi I'm wondering if a .tcl file would be run automatically each time a tracking state for an IP SLA (icmp-echo) changes from/to up/down? Based on some research, something like (I can't test if this works because Tcl/EEM doesn't work properly with routers in GNS3)

E.g. 

 

event manager applet test
event track 1 state up
action 1.0 cli command "enable"
action 1.1 cli command "tclsh flash:/1.tcl"
event track 1 state down
action 1.0 cli command "enable"
action 1.1 cli command "tclsh flash:/2.tcl"

 

 

Also, I think another option would be using ::cisco::eem::event_register with tracking and event_reqinfo but I'm not sure how I would pull the track state information to be used in a if else statement. This would also mean the one script. Thanks for any assistance.

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Hall of Fame Cisco Employee

Re: Tcl/EEM with IP SLA tracking down/up

Yes, it will, but this approach is not recommended.  Combining EEM and tclsh in this manner will just burn resources.  You could likely do everything you want in EEM itself.

9 REPLIES 9
VIP Advisor

Re: Tcl/EEM with IP SLA tracking down/up

Since we are not sure inside the content of TCL, why not run same task with EEM, rather adding another complexity.

until you have reason ? please show us the tcl action and explain more to understand your use case.

 

reference :

 

https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/eem/configuration/15-mt/eem-15-mt-book/eem-policy-tcl.html#GUID-766B6639-5F55-494D-9137-5B1541F50EDE

BB
*** Rate All Helpful Responses ***
Beginner

Re: Tcl/EEM with IP SLA tracking down/up

Ah, basically the two files would be doing something different based on the track status, the Tcl tasks are something that can't be done in EEM actions. I'm mainly asking if EEM will actually run the .tcl files if the states changed.
Hall of Fame Cisco Employee

Re: Tcl/EEM with IP SLA tracking down/up

Yes, it will, but this approach is not recommended.  Combining EEM and tclsh in this manner will just burn resources.  You could likely do everything you want in EEM itself.

Beginner

Re: Tcl/EEM with IP SLA tracking down/up

Ok thanks. Basically I need to send different POST requests using Tcl after a state change. I don't believe that is supported in EEM.
Hall of Fame Cisco Employee

Re: Tcl/EEM with IP SLA tracking down/up

Correct, you can't do that in an applet, but you can do it with EEM+Tcl.  Meaning, convert your applet to Tcl using https://www.marcuscom.com/convert_applet/ and then fold in your tclsh code into that.  Then you are only using one subsystem to execute your automation.

Beginner

Re: Tcl/EEM with IP SLA tracking down/up

Great tool, thanks for that. What would happen my device doesn't support the namespace import lines though?

VIP Advisor

Re: Tcl/EEM with IP SLA tracking down/up

Other option to move to next version which support or accept the limitation and make arrangement as per the available options.

or do the task out of the box.

 

BB
*** Rate All Helpful Responses ***
Highlighted
Hall of Fame Cisco Employee

Re: Tcl/EEM with IP SLA tracking down/up

All versions of IOS that support EEM+Tcl support those namespaces.  Make sure you're registering the EEM+Tcl scripts as user policies following https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/eem/configuration/15-mt/eem-15-mt-book/eem-policy-tcl.html#GUID-4EA20060-0678-4652-BD64-C10D9FC0DFBB .

Beginner

Re: Tcl/EEM with IP SLA tracking down/up

Ah I see. I had no trouble using EEM and Tcl separately but couldn't get the namespaces working in Tclsh. I never configured those policy settings. Thanks.
CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards