[c-nsp] cisco-nsp Digest, Vol 47, Issue 53

Rick Williams rwill at cisco.com
Mon Oct 16 13:48:30 EDT 2006


Hi jr,

You might try something like the following:

event manager applet testit1
event syslog pattern "%SYS-5-CONFIG_I: Configured from console by  
console"
action 1 cli command "en"
action 2 cli command "conf t"
action 3 cli command "event manager applet testit2"
action 3.1 cli command "event timer watchdog name doIn30secs time 30"
action 3.2 cli command "action 1 syslog msg \"testit2 ran\""
action 3.3 cli command "action 2 cli command \"en\""
action 3.4 cli command "action 3 cli command \"conf t\""
action 3.5 cli command "action 4 cli command \"no event manager  
applet testit2\""
action 3.6 cli command "action 5 cli command \"end\""
action 4 cli command "end"
action 5 syslog msg "testit2 set by testit1"
!

snow#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
snow(config)#^Z
snow#
Oct 16 13:37:18.491: %SYS-5-CONFIG_I: Configured from console by console
Oct 16 13:37:19.843: %SYS-5-CONFIG_I: Configured from console by  onvty0
Oct 16 13:37:19.000: %HA_EM-6-LOG: testit1: testit2 set by testit1
snow#
snow#
snow#
Oct 16 13:37:49.000: %HA_EM-6-LOG: testit2: testit2 ran
Oct 16 13:37:50.010: %SYS-5-CONFIG_I: Configured from console by  onvty0

Basically, register another applet with a watchdog event based on the  
syslog. When the second applet runs, it unregisters itself.

Alternatively, you can use a Tcl-based policy.

Regards,

Rick Williams,
Product Manager
Network Software and Systems Technology Group
Cisco Systems, Inc.
(919) 392-4640


> Date: Mon, 16 Oct 2006 17:57:02 +0200
> From: Johannes Resch <jr at xor.at>
> Subject: [c-nsp] EEM question: event timer and syslog
> To: cisco-nsp at puck.nether.net
> Message-ID: <4533ABCE.4050600 at xor.at>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> hi,
>
> I thought I could give EEM a try to achieve a workaround for some
> PPP related strangeness.
>
> basically, what I need to do is to monitor syslog for a certain  
> string,
> wait a couple of seconds and then execute a CLI command.
>
> for me, the "obvious" way to achieve this would be (watch out,
> pseudo-syntax!)
>
> x) define applet foo1
>     -event syslog pattern <string>
>     -action sleep <time>
>     -action cli "command"
>
> given the lack of a "sleep" command, the next best approach would be
>
> x) define applet foo1
>     -event syslog pattern <string>
>     -action set timer <timer> countdown <time>
>
> x) define applet foo2
>     -event timer <timer> expired
>     -action cli <command>
>
>
> but it seems impossible to set a timer as an action.
> is there something else in EEM that could be used for this purpose?
>
> any input appreciated,
>
> regards,
> -jr
>
>
>
> ------------------------------
>
> _______________________________________________
> cisco-nsp mailing list
> cisco-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-nsp
>
>
> End of cisco-nsp Digest, Vol 47, Issue 53
> *****************************************



More information about the cisco-nsp mailing list