Here you will learn what EEM (Embedded Event Manager) is.
EEM is a Cisco IOS feature that lets you automate tasks directly on a router.How EEM Works
The idea is simple:
An event happens (example: an interface goes down, a syslog message appears, a command is entered)
EEM reacts by executing one or more actions automatically
To understand this, look at the diagram below.

Figure 1 - Event Sources
1. Event Sources
Event Sources are the different “inputs” that EEM can monitor on the device.
In this figure, you can see common examples:Syslog: a log message is generated
SNMP: a trap is received
Timer: a scheduled trigger
CLI: a command is entered
Interface: a link/state change is detected
Answer the question below
Which component generates a log message that EEM can monitor?
2. EEM Engine
The EEM Engine is the component that receives these events and checks whether they match a condition you configured.
In other words: events arrive at the top, and the engine decides whether something should happen next.
Figure 2 - EEM Engine
Answer the question below
Which component decides whether an event should trigger an action?
3. EEM Applets
Now let’s extend the workflow: when an event matches, EEM can launch an applet.

Figure 3 - EEM Applet
An EEM applet is a small IOS script that describes what to react to and what to do when it happens.
It contains:
an event: the trigger condition
actions: the list of tasks the device will execute

Figure 4 - EEM Applet details
If we summarize the full chain:
Event Sources: an event happens (example: syslog “interface down”)
EEM Engine: EEM detects it and checks for a match
EEM Applet: if there is a match, EEM runs the applet actions (the “script” executed automatically)
Answer the question below
What IOS feature contains the trigger and the list of actions to execute automatically?
Now that you understand how EEM works, it’s time to practice.
You will build 3 applets on R1, each one introducing a new concept:
reacting to a syslog event
adding a custom syslog message
triggering an applet manually
Applet 1 — Interface auto-recovery
In this applet, you will make sure that if interface Gi0/0 goes down, EEM detects the syslog message and automatically runs CLI commands to bring the interface back up.
First, you create the applet and give it a name. Here the applet name is
AUTO_RECOVERY:R1# conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)# event manager applet AUTO_RECOVERYRight after that, you define the event (the trigger).
This line tells EEM what to listen for in the syslog buffer:R1(config-applet)# event syslog pattern "Interface GigabitEthernet0/0, changed state to down"Meaning: as soon as the router generates a syslog message that contains this exact text, the applet is triggered.
Then you define the actions (what EEM will execute when the event matches).
Here EEM will open a CLI session and inject commands exactly like a human would:R1(config-applet)# action 1.0 cli command "enable" R1(config-applet)# action 2.0 cli command "conf t" R1(config-applet)# action 3.0 cli command "interface g0/0" R1(config-applet)# action 4.0 cli command "no shutdown" R1(config-applet)# endAt this point, the logic is:
Syslog event appears: Interface GigabitEthernet0/0, changed state to down
EEM triggers
AUTO_RECOVERYEEM runs the CLI actions in order, ending with no shutdown
To see exactly what EEM is injecting into the CLI, enable this debug:
R1# debug event manager action cliNow shut down the interface to trigger the syslog event:
R1# conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)# int g0/0 R1(config-if)# shutdown *Feb 11 16:20:13.414: %SYS-5-CONFIG_I: Configured from console by console *Feb 11 16:20:15.024: %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively down *Feb 11 16:20:16.024: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down *Feb 11 16:20:16.052: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : CTL : cli_open called. *Feb 11 16:20:16.057: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : OUT : R1> *Feb 11 16:20:16.057: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : IN : R1>enable *Feb 11 16:20:16.068: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : OUT : R1# *Feb 11 16:20:16.068: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : IN : R1#conf t *Feb 11 16:20:16.078: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line. End with CNTL/Z. *Feb 11 16:20:16.078: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : OUT : R1(config)# *Feb 11 16:20:16.079: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : IN : R1(config)#interface g0/0 *Feb 11 16:20:16.189: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : OUT : R1(config-if)# *Feb 11 16:20:16.190: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : IN : R1(config-if)#no shutdown *Feb 11 16:20:16.351: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : OUT : R1(config-if)# *Feb 11 16:20:16.352: %HA_EM-6-LOG: AUTO_RECOVERY : DEBUG(cli_lib) : : CTL : cli_close called. *Feb 11 16:20:16.358: tty is now going through its death sequence *Feb 11 16:20:18.205: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up *Feb 11 16:20:19.205: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to upIn the output, you should notice:
The syslog lines showing the interface going down (that’s the trigger)
The EEM debug lines showing the commands being executed automatically (that’s the applet running)
Finally, the interface comes back up after the
no shutdown
Answer the question below
What command inside the applet actually brings the interface back up?
Applet 2 — Custom syslog notification + auto-recovery
In this applet, you keep the same auto-recovery idea, but you add one extra thing: EEM will write your own syslog message when the event is triggered.
This is useful because you can clearly see that EEM fired (not just “the interface went down”).First, you create the applet and give it a name. Here the applet name is
AUTO_RECOVERY_LOG:R1# conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)# event manager applet AUTO_RECOVERY_LOGRight after that, you define the event (the trigger).
This line tells EEM what to match in syslog:R1(config-applet)# event syslog pattern "Interface GigabitEthernet0/1, changed state to down"Meaning: as soon as the router generates a syslog message containing this text (Gi0/1 goes down), the applet is triggered.
Then you define the actions.
The first action is different from Applet 1: instead of running CLI immediately, EEM generates a custom syslog message:R1(config-applet)# action 1.0 syslog msg "EEM detected Gi0/1 down - recovery initiated"After that, it runs the same kind of CLI injection to bring the interface back up:
R1(config-applet)# action 2.0 cli command "enable" R1(config-applet)# action 3.0 cli command "conf t" R1(config-applet)# action 4.0 cli command "interface g0/1" R1(config-applet)# action 5.0 cli command "no shutdown" R1(config-applet)# exitAt this point, the logic is:
Syslog event appears: Interface GigabitEthernet0/1 changed state to down
EEM triggers
AUTO_RECOVERY_LOGEEM writes its own syslog message
EEM injects CLI commands and ends with no shutdown
Now shut down the interface to trigger the syslog event:
R1(config)# int g0/1 R1(config-if)# shutdown *Feb 11 16:38:52.978: %SYS-5-CONFIG_I: Configured from console by console *Feb 11 16:38:54.465: %LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to administratively down *Feb 11 16:38:55.464: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down *Feb 11 16:38:55.485: %HA_EM-6-LOG: AUTO_RECOVERY_LOG: EEM detected Gi0/1 down - recovery initiated *Feb 11 16:38:55.487: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : CTL : cli_open called. *Feb 11 16:38:55.490: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : OUT : R1> *Feb 11 16:38:55.491: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : IN : R1>enable *Feb 11 16:38:55.501: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : OUT : R1# *Feb 11 16:38:55.501: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : IN : R1#conf t *Feb 11 16:38:55.512: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line. End with CNTL/Z. *Feb 11 16:38:55.512: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : OUT : R1(config)# *Feb 11 16:38:55.512: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : IN : R1(config)#interface g0/1 *Feb 11 16:38:55.622: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : OUT : R1(config-if)# *Feb 11 16:38:55.622: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : IN : R1(config-if)#no shutdown *Feb 11 16:38:55.786: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : OUT : R1(config-if)# *Feb 11 16:38:55.786: %HA_EM-6-LOG: AUTO_RECOVERY_LOG : DEBUG(cli_lib) : : CTL : cli_close called. *Feb 11 16:38:55.927: *Feb 11 16:38:55.927: tty is now going through its death sequence *Feb 11 16:38:57.632: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up *Feb 11 16:38:58.632: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to upIn the output, you should notice:
The syslog lines showing the interface going down (that’s the trigger)
The custom EEM syslog message (that proves the applet fired)
The EEM debug lines showing the CLI commands being executed (recovery)
Finally, the interface comes back up after the
no shutdown
Answer the question below
In Applet 2, the custom message is generated using the action keyword "syslog". What follows "syslog" in the command?
Applet 3 — Manual applet execution
In this applet, you will create an EEM applet that does not trigger automatically.
Instead, you will run it manually from the CLI, which is useful to test EEM logic safely before attaching it to a real event.First, you create the applet and give it a name. Here the applet name is
MANUAL_TEST:R1# conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)# event manager applet MANUAL_TESTRight after that, you define the event (the trigger).
Here the trigger isevent none, which means: do not listen for syslog, CLI, timer, or anything else.R1(config-applet)# event noneMeaning: the applet will never start by itself.
Then you define the action.
Here EEM simply generates a syslog message so you can confirm the applet executed successfully:R1(config-applet)# action 1.0 syslog msg "Manual EEM execution successful" R1(config-applet)# endAt this point, the logic is:
No automatic trigger (event none)
You run it yourself from the CLI
EEM prints a syslog message as proof of execution
Now run the applet manually:
R1# event manager run MANUAL_TEST *Feb 11 17:11:53.436: %HA_EM-6-LOG: MANUAL_TEST: Manual EEM execution successfulIn the output, you should notice:
The
%HA_EM-6-LOGline is generated by EEMIt includes the applet name (
MANUAL_TEST)It includes your custom message, confirming the manual execution worked
Answer the question below
Which command do you use to manually execute an EEM applet from the CLI?
Answer the question below
%LINK-5-CHANGED and %LINEPROTO-5-UPDOWN both fired: which facility matched AUTO_RECOVERY?