Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Run an EEM applet on the basis of Reload Reason

I want to run an EEM after router reloads only if the reload was initiated by an EEM applet. I want this EEM to trigger after 10 mins of reload.

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Then you could have an applet

Then you could have an applet that runs a reload and configures this other applet if the reload reason is right.  You can use the example below as a template:

 

event manager environment q "

!

event manager applet reload

 event timer cron cron-entry "@reboot"

 action 001 cli command "enable"

 action 002 cli command "show ver | inc Last reload reason: Embedded Event Manager action"

 action 003 regexp "Embedded Event Manager action" $_cli_result

 action 004 if $_regexp_result eq 1

 action 005  cli command "config t"

 action 006 cli command "event manager applet do-stuff"

 action 007 cli command "event timer countdown time 600"

 action 008 cli command "action 1.0 cli command enable"

 action 009 cli command "action 2.0 cli command $q config t$q"

 ...

4 REPLIES
Cisco Employee

I don't recall, but does the

I don't recall, but does the reload reason (in show ver) actually state reloaded by EEM (or similar) if an EEM policy reloads the device?

Community Member

Yes it does as shown below...

Yes it does as shown below...

 

Last reload reason: Embedded Event Manager action

Cisco Employee

Then you could have an applet

Then you could have an applet that runs a reload and configures this other applet if the reload reason is right.  You can use the example below as a template:

 

event manager environment q "

!

event manager applet reload

 event timer cron cron-entry "@reboot"

 action 001 cli command "enable"

 action 002 cli command "show ver | inc Last reload reason: Embedded Event Manager action"

 action 003 regexp "Embedded Event Manager action" $_cli_result

 action 004 if $_regexp_result eq 1

 action 005  cli command "config t"

 action 006 cli command "event manager applet do-stuff"

 action 007 cli command "event timer countdown time 600"

 action 008 cli command "action 1.0 cli command enable"

 action 009 cli command "action 2.0 cli command $q config t$q"

 ...

Community Member

Thank You Joseph, it worked.

Thank You Joseph, it worked.

434
Views
0
Helpful
4
Replies
CreatePlease to create content