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

Need help creating an EEM/TCL script to issue commands based on an event

Tracy Larson
Level 4
Level 4

I have a 2801 router and want to create a script that will detect when its WAN interface is seeing errors then issues these commands to these voice ports.

voice-port 0/1/0

connection plar 1804

voice-port 0/1/1

connection plar 1804

voice-port 0/1/2

connection plar 1804

The WAN port is a controller T1 card on port 0/2/0

I also want it to set the connection plar commands to 1801 when the connection to the WAN interface is stable once again but maybe wait for about 3 minutes before that happens.

Any help would be greatly appreciated as I am not a programmer by any means.

Thank you in advance.

1 Accepted Solution

Accepted Solutions

No, these applets go straight into the running config. The only thing you need to change if the various error thresholds (if desired).

View solution in original post

9 Replies 9

Joe Clarke
Cisco Employee
Cisco Employee

What version of code is this device running?

Version 12.4(24)T

I think you can accomplish everything you want with applets. The first applet will watch for the errors to spike at or above 10 within 10 seconds. It will rearm itself when the errors have fallen to at or below 1 within 10 seconds. Adjust these values as needed:

event manager applet wan-errors

event interface name Serial0/2/0 parameter input_errors entry-op ge entry-val 10 entry-type increment exit-op le exit-val 1 exit-type increment poll-interval 10

action 001 counter name "stable-wan" op nop

action 002 if $_counter_value_remain op ge 1

action 003 if $_counter_value_remain op lt 18

action 004 counter name "stable-wan" op set value 0

action 005 exit 1

action 006 end

action 007 end

action 008 counter name "stable-wan" op set value 0

action 009 cli command "enable"

action 010 cli command "config t"

action 011 cli command "voice-port 0/1/0"

action 012 cli command "connection plar 1804"

action 013 cli command "voice-port 0/1/1"

action 014 cli command "connection plar 1804"

action 015 cli command "voice-port 0/1/2"

action 016 cli command "connection plar 1804"

action 017 cli command "end"

Then, another applet will run every time the error count is at or below 1. This applet will count the number of times the errors are low:

event manager applet wan-recover

event interface name Serial0/2/0 parameter input_errors entry-op le entry-val 1 entry-type increment poll-interval 10

action 1.0 counter name "stable-wan" op inc value 1

Finally, when the count reaches 18, revert the config changes:

event manager applet wan-is-stable

event counter name stable-wan entry-val 18 entry-op ge exit-val 0 exit-op eq

action 001 counter name "stable-wan" op set value 0

action 002 cli command "enable"

action 003 cli command "config t"

action 004 cli command "voice-port 0/1/0"

action 005 cli command "connection plar 1801"

action 006 cli command "voice-port 0/1/1"

action 007 cli command "connection plar 1801"

action 008 cli command "voice-port 0/1/2"

action 009 cli command "connection plar 1801"

action 010 cli command "end"

Thank you for your quick response, this will help immensley! I will load this into a test router and check it out. Also, do i just take the code plug it into notepad and give it the .tcl extension then load it into the router? Once that is done how do I "enable" it to run in the background?

No, these applets go straight into the running config. The only thing you need to change if the various error thresholds (if desired).

awesome, i will give this a go. Thank you so much for the help!

One more question on this applet. Lets say i wanted to make some sort of threshhold for it to key off of, say 20 errors or less in that 3 minute window and have the applet think things are still stable, is there a parameter in there i can set that to?

In the above examples, I set 10 errors within 10 seconds to be the unacceptable threshold. The falling (acceptable) level is 1 error within 10 seconds. Every time the interface receives 1 or less errors within 10 seconds, a counter will get incremented. After 180 seconds, the PLAR values will be reset.

If you wanted to set the acceptable threshold to 20, then change the 1's to 20's. You'll then want to increase the unacceptable threshold of 10 to a more realistic value.

Thank you again. This is very much appreciated.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: