EEM: Embedded Event Manager Applets and Scripts
How Cisco EEM reacts to on-box events (syslog, SNMP thresholds, timers, interface state) with applets or Tcl scripts: CCNP ENCOR automation, no external tool.
- EEM = event-driven automation running on the router itself. No orchestrator, no external server. See a syslog / SNMP threshold / CLI command → run actions.
- Two flavors: applets (short, IOS CLI) and Tcl scripts (larger, real logic, live in flash). Applets cover 95% of what people actually do.
- Classic uses: auto-collect debug on adjacency flap, email on config change, revert config after N minutes if not confirmed, disable a port after too many CRC errors.
The one-sentence mental model
EEM is a while True: watch for X, do Y loop inside every Cisco router. No Python server, no NETCONF client: the box reacts to itself.
Anatomy of an applet
event manager applet CATCH-BGP-FLAP
event syslog pattern "BGP-5-ADJCHANGE.*Down"
action 1.0 cli command "enable"
action 2.0 cli command "show ip bgp summary"
action 3.0 cli command "show ip bgp neighbors"
action 4.0 syslog msg "EEM captured BGP flap"
action 5.0 mail server "10.0.0.50" to "netops@corp.com" ...
Three parts:
- Applet name: must be unique.
- Event: the trigger. Choose from ~30 event types.
- Actions: the response, numbered so the order is predictable.
Common event types
| Event | Fires when |
|---|---|
syslog pattern "REGEX" | Any log line matches the regex. |
snmp oid X.Y.Z threshold ... | SNMP polled value crosses a threshold. |
interface name Gi0/1 parameter input-errors ... | Interface counter changes. |
timer cron ... | On a schedule (“every 5 min”, “at 03:00 daily”). |
timer countdown ... | Once, after N seconds. |
timer watchdog time ... | Repeatedly, every N seconds. |
| `track object X state up | down` |
cli pattern "REGEX" | An admin types a matching command. |
none | Manual trigger with event manager run APPLET. |
Actions you have available
- cli command ”..”: run a CLI command, capture output (
$_cli_result). - syslog msg ”..”: log an EEM-generated message.
- mail server X to Y subject ”..” body ”..”: send email (must have SMTP server reachable).
- snmp-trap: send an SNMP trap.
- puts / info / regexp: string manipulation.
- counter name X op set|add value N: bump an internal counter.
- set var VALUE: assign a variable, used later with
$var. - wait 5: sleep 5 seconds.
Classic use cases
Auto-collect on OSPF adjacency flap
event manager applet OSPF-FLAP-CAPTURE
event syslog pattern "OSPF.*Neighbor Down"
action 1.0 cli command "enable"
action 2.0 cli command "show ip ospf neighbor detail"
action 3.0 cli command "show ip ospf interface"
action 4.0 cli command "show logging"
action 5.0 file open OUTPUT flash:/eem-ospf-flap.log w
action 6.0 file puts OUTPUT "$_cli_result"
action 7.0 file close OUTPUT
Next time OSPF flaps at 3 AM, the diagnostics are already on flash. No “please try to catch it next time”.
Config-change auto-rollback (config-replace pattern)
event manager applet CONFIG-CONFIRM
event none maxrun 700
action 1.0 cli command "enable"
action 2.0 cli command "copy running-config flash:pre-change.cfg" pattern "filename"
action 2.1 cli command ""
action 3.0 wait 600
action 4.0 cli command "configure replace flash:pre-change.cfg force"
Trigger it manually before a risky change with event manager run CONFIG-CONFIRM. After 10 minutes the config rolls back to the saved copy, so a change that cut off your access undoes itself. Saves careers. The catch: this applet always rolls back, so for a confirm-or-rollback workflow use the built-in timer below.
IOS also has this built in, without EEM: configure terminal revert timer 10, make the change, then configure confirm once you’ve verified it. If you lose access and never confirm, the router rolls back on its own. (It needs archive with a path configured first.)
Disable an interface after a CRC storm
event manager applet CRC-STORM
event interface name GigabitEthernet0/1 parameter input_errors_crc entry-op ge entry-val 1000 entry-type increment poll-interval 60
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "interface Gi0/1"
action 4.0 cli command "shutdown"
action 5.0 syslog msg "EEM shut Gi0/1 after CRC storm"
Tcl scripts vs applets
If your logic needs loops, conditionals more complex than a single if, or arithmetic, move up to Tcl scripts:
event manager directory user policy flash:/eem-scripts/
event manager policy check-bandwidth.tcl
The .tcl file is a full Tcl program with access to the same event / action library. 90% of real EEM use stays in applets. Tcl is there when you need it.
Verification
show event manager policy registered
show event manager history events
show event manager statistics
debug event manager action cli ! see actions live
history events is invaluable: shows recent EEM triggers and their outcomes (the last N events, set with event manager history size events).
Common exam / real-world mistakes
- Missing
event manager appletprivilege. Applets run with the applet’s configured priv (default 15). Actions likecli command "enable"are needed because applet default doesn’t inherit enable mode. - Bad regex. Cisco’s syslog patterns use POSIX regex-like syntax and are case sensitive. Test against actual log strings:
"neighbor down"never matchesNeighbor Down. - Blocking on wait/mail. If SMTP is down,
mail serverblocks. Watch out on frequent-fire applets. - Not versioning applets. They live in config. Treat them like code. Copy to a repo, apply via config management (Ansible / NetMiko).
- Firing recursively. A syslog-triggered applet that itself generates syslog can re-trigger. Add a guard condition or
seta variable to break the loop.
Cheat strip
Job event-driven automation inside the router itself
Trigger syslog | snmp | timer | interface | track | cli | none
Actions cli / syslog / mail / snmp-trap / file / regexp / wait / set
Applet short, config-embedded
Tcl script larger, file on flash
Classic uses:
- auto-collect debug on adjacency flap
- config auto-rollback if not confirmed
- shut interface after error threshold
- alert on config change
Verify show event manager policy registered
show event manager history events
Practice: quick check
Every question in the bank, once. No repeats. Missed ones cycle back at the end.
CoPP: Control Plane Policing
Why routers need CoPP, how it rate-limits traffic destined to the CPU (routing protocols, SNMP, SSH, ARP), and the classify/police policy shape CCNP ENCOR tests.
NETCONF and RESTCONF: Model-Driven Network APIs
How NETCONF (XML over SSH) and RESTCONF (JSON/XML over HTTPS) let you configure Cisco IOS-XE / NX-OS programmatically using YANG models. Config datastores, capabilities, and where each fits.
Want this drilled into reflex?
1:1 weekly sessions, live feedback on your labs, and US interview prep: built around the CCNP® exam blueprint. Free first session. No card on file until you decide.
Related topics
OSPF Single-Area
CCNA OSPF guide: link-state model, seven neighbor states, LSA types, DR/BDR election, cost tuning, authentication, summarization and 8 worked scenarios.
Automation & ProgrammabilityPython for Network Engineers
Why Python leads network automation, plus four libraries you'll use: Netmiko (SSH), NAPALM (vendor-agnostic), Nornir (parallel runner) and requests (REST).
IP ServicesSNMP: Simple Network Management Protocol
How monitoring systems pull metrics and receive alerts from network devices. Covers SNMPv1/v2c/v3, community strings, traps vs informs, MIB / OID navigation, and why SNMPv3 is the only one acceptable in 2026.
Stuck on EEM: Embedded Event Manager Applets and Scripts?
Walk your plan with a senior US network engineer in a free 20 minute call. We find the one thing blocking you and name the next step. No card. No pitch.
- 20 minutes, 1:1 with a senior US network engineer
- No card, no obligation, no sales pitch
- You pick the slot that fits your week
Get the free CCNA 12-week roadmap
You're already reading up on EEM: Embedded Event Manager Applets and Scripts. The roadmap is the order I recommend studying every CCNA topic in: with what to lab each week and where EEM: Embedded Event Manager Applets and Scripts fits. A written personal reply, not an autoresponder. Expect it within one business day.
Personal reply from a senior network engineer. No third-party tracking. Unsubscribe any time.
