action 1.0 cli command [cmd]
Defines an Embedded Event Manager (EEM) applet action that executes a specified Cisco IOS CLI command when the applet is triggered.
action 1.0 cli command [cmd]When to Use This Command
- Automatically save the running configuration to startup configuration when a critical interface goes down.
- Send a custom syslog message and execute a show command to capture interface status when a routing protocol neighbor is lost.
- Automatically clear counters on an interface after a maintenance window to reset statistics.
- Execute a ping to a remote server and log the result when a specific event occurs.
Command Examples
Save configuration on interface down
action 1.0 cli command "write memory"This action executes the 'write memory' command to save the running configuration to startup configuration. No output is displayed as the command runs silently.
Send syslog and show interface status
action 2.0 cli command "show interfaces GigabitEthernet0/1"GigabitEthernet0/1 is up, line protocol is up
Hardware is CN Gigabit Ethernet, address is aabb.cc00.0201 (bia aabb.cc00.0201)
Internet address is 192.168.1.1/24
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full Duplex, 1000Mbps, link type is auto, media type is RJ45
output flow-control is unsupported, input flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 1000 bits/sec, 2 packets/sec
5 minute output rate 500 bits/sec, 1 packets/sec
12345 packets input, 1234567 bytes
Received 123 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
0 input packets with dribble condition detected
23456 packets output, 2345678 bytes
0 underruns, 0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped outThis action runs 'show interfaces GigabitEthernet0/1' to display the status and statistics of the interface. The output shows interface status (up/down), IP address, MTU, bandwidth, delay, reliability, load, duplex, speed, and detailed packet counters. Key fields to monitor: 'line protocol is up' indicates Layer 2 connectivity; 'input errors' and 'output errors' should be zero; 'CRC' errors indicate physical layer issues.
Understanding the Output
The 'action cli command' itself does not produce output directly; instead, it executes the specified CLI command. The output shown is the result of that command. In EEM applet configuration, the action is defined but the output is not displayed until the applet triggers. When troubleshooting, you would check the syslog or the output of the command if it is redirected (e.g., using 'append' or 'redirect' options). For example, if the action runs 'show interfaces', the output can be sent to a syslog server or stored in a file. In the output, look for interface status (up/down), error counters (input errors, CRC, output errors), and load metrics. Good values: interface up/up, zero errors, low utilization. Bad values: interface down, high CRC errors, excessive drops.
CCNA Exam Tips
CCNA exam tip: EEM applets are configured in global configuration mode, not interface mode. Remember the 'event manager applet' command starts the applet definition.
CCNA exam tip: The 'action' command must be numbered (e.g., action 1.0) and the CLI command must be enclosed in double quotes.
CCNA exam tip: EEM applets can be triggered by events like syslog patterns, interface state changes, or timers. Know the 'event syslog' and 'event interface' triggers.
CCNA exam tip: The 'cli command' action can include 'append' or 'redirect' to save output to a file, which is useful for logging.
Common Mistakes
Mistake 1: Forgetting to enclose the CLI command in double quotes, causing a syntax error.
Mistake 2: Using an invalid action number (e.g., action 0.0) — action numbers must start at 1.0.
Mistake 3: Not specifying the full command path (e.g., using 'write memory' instead of 'write memory' is fine, but some commands require 'do' prefix in certain modes).
Related Commands
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions