EEM — Embedded Event Manager Applets and Scripts
How EEM lets a Cisco router react to on-box events automatically: syslog triggers, SNMP thresholds, timers, interface state — all handled with tiny applets or Tcl scripts. The CCNP ENCOR automation you can enable without any 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 | last 100"
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
action 1.0 cli command "enable"
action 2.0 cli command "archive"
action 3.0 cli command "path flash:pre-change"
action 4.0 cli command "end"
action 5.0 cli command "archive config"
action 6.0 wait 600
action 7.0 cli command "configure replace flash:pre-change force"
Trigger it manually before a risky change with event manager run CONFIG-CONFIRM. If you don’t cancel it in 10 minutes, the config auto-rolls back. Saves careers.
Disable a flapping interface
event manager applet CRC-STORM
event snmp oid 1.3.6.1.2.1.31.1.1.1.10.10101 get-type exact entry-op ge entry-val 1000 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 every EEM trigger and its outcome for the last N days.
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. Test against actual log strings —
%OSPF-5-ADJCHG:is different fromOSPF-5-ADJCHG. - 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
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
Definitive CCNA-level OSPF guide — link-state mental model, seven neighbor states, LSA types, DR/BDR election, cost tuning, authentication, route summarization, common debug patterns, and 8 worked scenarios.
Automation & ProgrammabilityPython for Network Engineers
Why Python is the de-facto language for network automation, plus the four libraries you'll actually use — Netmiko (SSH), NAPALM (vendor-agnostic), Nornir (parallel runner), and requests (REST APIs).
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.
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.