6. action label cli command cli-string [ pattern pattern-string ] 7. end 8. show event manager policy active 9. show event manager history events DETAILED STEPS Procedure Shells and Scripting Adding a Python Script in an EEM Applet Command or Action Purpose Step 1 enable Example: Device> enable Enables privileged EXEC mode. • Enter your password if prompted. Step 2 configure terminal Example: Device# configure terminal Enters global configuration mode. Step 3 event manager applet applet-name Example: Device(config)# event manager applet interface Shutdown _ Registers an applet with the Embedded Event Manager (EEM) and enters applet configuration mode.
Step 4 event [tag event-tag] syslog pattern regular-expression Example: Device(config-applet)# event syslog pattern "Interface Loopback55, changed state to administratively down" Specifies a regular expression to perform the syslog message pattern match. Step 5 action label cli command cli-string Example: Device(config-applet)# action 0.0 cli command "en" Specifies the IOS command to be executed when an EEM applet is triggered. Step 6 action label cli command cli-string [ pattern pattern-string ] Example: Device(config-applet)# action 1.0 cli command "guestshell run python3 /bootflash/eem script.py _ loop55" Specifies the action to be specified with the pattern keyword.
• Specify a regular expression pattern string that will match the next solicited prompt. Step 7 end Example: Device(config-applet)# end Exits applet configuration mode and returns to privileged EXEC mode. Step 8 show event manager policy active Example: Displays EEM policies that are executing. Programmability Configuration Guide, Cisco IOS XE 17.16.x 150