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

Tcl/EEM with IP SLA tracking down/up

acisco
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

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.

View solution in original post

9 Replies 9

balaji.bandi
Hall of Fame
Hall of Fame

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 *****

How to Ask The Cisco Community for Help

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.

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.

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.

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.

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

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 *****

How to Ask The Cisco Community for Help

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 .

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.

Review Cisco Networking for a $25 gift card