10-09-2007 05:42 PM
Hi guys, as per my code below, every 20 seconds a syslog message is generated saying "Site is on ISDN" (I have set it to 20 seconds for testing purposes but will change it to 30 minutes before putting it into production). What I would like to do is instead of having the static message I would like it to say "This site has been on ISDN for X minutes". It would be as easy as doubling the variable every time the script is run but I'm not too sure how to use the count or increment options in the Applet. Any information/assistance would be greatly appreciated.
Thanks.
event manager applet isdn_on1
event syslog occurs 1 pattern "Line protocol on Interface Async1, changed state to up"
action 1.0 cli command "enable"
action 1.1 cli command "conf t"
action 1.2 cli command "event manager applet isdn_on2"
action 1.3 cli command "event timer countdown time 20"
action 1.4 cli command "exit"
event manager applet isdn_on2
event none
action 1.0 syslog priority 5 msg "Site is on ISDN"
action 1.1 cli command "enable"
action 1.2 cli command "conf t"
action 1.3 cli command "event manager applet isdn_on2"
action 1.4 cli command "event timer countdown time 20"
action 1.5 cli command "exit"
10-09-2007 07:48 PM
It sounds like what you want would be best achieved by converting your applet to a TCL policy. Currently, there is no way to do mathematical operations within an EEM applet policy.
Your timer policy could also be implemented as a watchdog which would reset the timer each time it runs.
10-09-2007 08:12 PM
I too thought TCL would be the best option but I have tried several times to follow all sorts of different tutorials to get this working but haven't had any luck. Are you able to help me out/give me any pointers? I'd really appreciate it.
10-09-2007 08:19 PM
Please post what you have tried with TCL, and I will look it over.
10-09-2007 08:25 PM
Well that's the thing, I don't know where to start. I mean I have written a TCL script on a Cisco router before so everything on the router could be menu driven but with EEM I get confused with what to call and whether variables need to be environmental, etc. If I were to create a TCL script for this would you be able to tell me what is necessary to implement it?
However, I wouldn't know how to do things like searching the router's logs and adding log entries as I am no TCL expert.
10-09-2007 08:33 PM
By the way, what is the "counter" command for?
Router(config-applet)#action 1.0 counter name test op ?
dec Decrement the value of the counter by the given value
inc Increment the value of the counter by the given value
nop Read the value of the counter
set Set the value of the counter to the given value
10-09-2007 08:37 PM
The counter action and event detector allow you to count something, then based on that counter value, execute another event. I thought about this, but I don't think it will do what you want. It sounds like what you want would best be handled with contexts using a TCL policy.
An example of chaining together a timer policy with a counter policy can be found in the EEM applet guide at http://www.cisco.com/en/US/products/ps6017/products_feature_guide_chapter09186a00804d7d47.html#wp1051302 .
12-12-2023 01:31 PM - edited 12-12-2023 01:32 PM
Not surprisingly, this link no longer works after nearly 16 years.
10-11-2007 08:38 AM
I have been very busy lately, but I will reply with a sample policy when I get a chance.
10-11-2007 02:41 PM
Great, I'd really appreciate that. Take your time though no need to rush.
10-24-2007 12:41 PM
Here is an example TCL policy that should do what you want. To use it, copy it to your policy directory on flash, then register it:
event manager register isdn-timer.tcl type user
Then set an environment variable to tell the script which interface to watch to see if the router is running on ISDN. For example:
event manager environment isdn_interface Dialer0
Then you're done. It will run every 20 seconds, and do all of the checking for you. If it finds the router is on ISDN, it will send a syslog message. When it detects the router is no longer on ISDN, it will send a message then as well.
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