×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

Run an EEM applet on the basis of Reload Reason

Answered Question
Sep 17th, 2014
User Badges:

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.

Correct Answer by Joe Clarke about 2 years 11 months ago

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"

 ...

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Joe Clarke Thu, 09/18/2014 - 08:51
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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?

kiqbal0941 Fri, 09/19/2014 - 10:04
User Badges:

Yes it does as shown below...

 

Last reload reason: Embedded Event Manager action

Correct Answer
Joe Clarke Fri, 09/19/2014 - 10:36
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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"

 ...

Actions

This Discussion

Related Content