cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4606
Views
5
Helpful
10
Replies

EEM in an EEM

jackawang
Level 5
Level 5

The requirement is when the tracking object 12 is down, execute/create another event called reset-modem and it recursively run once every 60 seconds, until the tracking object 12 is up.

I’ve managed to come up with this configuration. Somehow Action 6.0 in the first EEM does not seem to be taken. I am think it could be related to the "" quotations. Can someone advise?

event manager applet track-down

event track 12 state down

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "event manager applet reset-modem"

action 4.0 cli command "event timer watchdog time 60"

action 5.0 cli command "action 1.0 cli command enable"

action 6.0 cli command "action 2.0 cli command test cellular 0 modem-power-cycle"

action 7.0 cli command "end"

!

event manager applet track-up

event track 12 state up

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager applet reset-modem"

action 4.0 cli command "end"

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

I had provided this solution to your SE.  You're missing a key piece:

event manager environment q "

!

event manager applet track-down

event track 1 state down

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "event manager applet reset-modem"

action 4.0 cli command "event timer watchdog time 1800"

action 5.0 cli command "action 1.0 cli command enable"

action 6.0 cli command "action 2.0 cli command $q test cellular 0

modem-power-cycle$q"

action 7.0 cli command "end"

!

event manager applet track-up

event track 1 state up

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager applet reset-modem"

action 4.0 cli command "end"

See that "$q" variable?  That is required to embed the double quote in the nested applet.

View solution in original post

10 Replies 10

cwildes
Level 1
Level 1

Jack,

Use "debug event manager action cli" and cause the policy to run to see why the action 6.0 does not execute.

Thanks,

Clyde

Here is what I got. I still believe it is because the action inside an action does not know where the actual commands starting from. I tried puting double quotes, it did not take the config.

track-down : DEBUG(cli_lib) : :  IN  : Router>enable

track-down : DEBUG(cli_lib) : : OUT : Router#

track-down : DEBUG(cli_lib) : : IN  : Router#config t

track-down : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line.  End with CNTL/Z.

track-down : DEBUG(cli_lib) : : OUT : Router(config)#

track-down : DEBUG(cli_lib) : : IN  : Router(config)#event manager applet reset-modem

track-down : DEBUG(cli_lib) : : OUT : Router(config-applet)#

track-down : DEBUG(cli_lib) : : IN  : Router(config-applet)#event timer watchdog time 60

track-down : DEBUG(cli_lib) : : OUT : Router(config-applet)#

track-down : DEBUG(cli_lib) : : IN  : Router(config-applet)#action 1.0 cli command enable

track-down : DEBUG(cli_lib) : : OUT : Router(config-applet)#

track-down : DEBUG(cli_lib) : : IN  : Router(config-applet)#action 2.0 cli command test cellular 0 modem-power-cycle

track-down : DEBUG(cli_lib) : : OUT :                                                   ^

track-down : DEBUG(cli_lib) : : OUT : % Invalid input detected at '^' marker.

track-down : DEBUG(cli_lib) : : OUT :

track-down : DEBUG(cli_lib) : : OUT : Router(config-applet)#

track-down : DEBUG(cli_lib) : : IN  : Router(config-applet)#end

Jack,

actions #5 and #6 seem to be incorrect. instead of:

    action 5.0 cli command "action 1.0 cli command enable"

    action 6.0 cli command "action 2.0 cli command test cellular 0 modem-power-cycle"

The should be:

    action 5.0 cli command "enable"

    action 6.0 cli command "test cellular 0 modem-power-cycle"

Also, you seem to use "enable" tiwce. You just need it once.

-Mihyar

Mihyar,

Please note I am creating another even inside the event. The second "action" belongs to the sub-event.

I tested your solution and it errored out at action 5.0.

OK, if this is what you want to do, you might want to consider this technique:

An applet without an event is created but not enabled.

You can manually create the applet without the event statement, then only add and remove the event in your other policies. This way, the actions are created ahead of time and you will avoid action 6 error.

-Mihyar

Joe Clarke
Cisco Employee
Cisco Employee

I had provided this solution to your SE.  You're missing a key piece:

event manager environment q "

!

event manager applet track-down

event track 1 state down

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "event manager applet reset-modem"

action 4.0 cli command "event timer watchdog time 1800"

action 5.0 cli command "action 1.0 cli command enable"

action 6.0 cli command "action 2.0 cli command $q test cellular 0

modem-power-cycle$q"

action 7.0 cli command "end"

!

event manager applet track-up

event track 1 state up

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager applet reset-modem"

action 4.0 cli command "end"

See that "$q" variable?  That is required to embed the double quote in the nested applet.

Defining the environment variable did the trick. I thought there must be a way to pass the quote there. Thank you!

Joseph,

Your solution worked fine but I had one question. When tracking objecct goes from up to down, the reset-modem event is inserted and it will keep reseting the modem once every 1800 seconds. What if I want the reset action to happen immediately for the first time then execute once every 1800 seconds recurrsively? Basically I want the reset-modem to run right away as soon as the tracking down is detected. Then keep trying once in a while, until tracking object is up.

Probably the easiest thing to do is to add the reset modem commands to the track-down applet.  That way, the commands will run, then you configure the watchdog applet.

Hi Joe

 

I found your script very useful.  I know this is an old thread but I recently had the same requirement.  I have a tunnel running over the cellular so tweaked it to look for tunnel0 status.  I also needed to tweak the watchdog part to get the required result.

 

track 1 interface Tunnel0 line-protocol
!
event manager environment q "
!
event manager applet CELLULAR-DOWN authorization bypass
 event track 1 state down maxrun 180
 action 1.1 cli command "enable"
 action 1.2 cli command "conf t"
 action 1.3 cli command "event manager applet RESET-MODEM authorization bypass"
 action 1.4 cli command "action 1.0 cli command enable"
 action 1.5 cli command "action 2.0 cli command $q test cellular 0 modem-reset$q"
 action 1.6 cli command "event timer watchdog time 60"
 action 1.7 cli command "end"
 action 1.8 wait 90
 action 1.9 cli command "conf t"
 action 2.0 cli command "event manager applet RESET-MODEM authorization bypass"
 action 2.1 cli command "event timer watchdog time 86400"
 action 2.2 cli command "end"
!
event manager applet CELLULAR-UP authorization bypass
 event track 1 state up
 action 1.0 cli command "enable"
 action 2.0 cli command "conf t"
 action 3.0 cli command "no event manager applet RESET-MODEM authorization bypass"
 action 4.0 cli command "end"
!

Review Cisco Networking for a $25 gift card