Exam 400-101 | Question id=752 | Infrastructure Services |
Which of the following command sets will cause an EEM applet to finish before the show running-config command is executed?
A. |
Router(config)#event manager applet shconf
Router(config-applet)#event cli pattern "show running-config" sync no skip no
Router(config-applet)#action 1.0 syslog msg "Running configuration displayed"
| |
B. |
Router(config)#event manager applet shconf
Router(config-applet)#event cli pattern "show running-config" sync no skip yes
Router(config-applet)#action 1.0 syslog msg "Running configuration displayed"
| |
C. |
Router(config)#event manager applet shconf
Router(config-applet)#event cli pattern "show running-config" sync yes
Router(config-applet)#action 1.0 syslog msg "Running configuration displayed"
Router(config-applet)#set 2.0 _exit_status 0
| |
D. |
Router(config)#event manager applet shconf
Router(config-applet)#event cli pattern "show running-config" sync yes
Router(config-applet)#action 1.0 syslog msg "Running configuration displayed"
Router(config-applet)#set 2.0 _exit_status 1
|
The following command set will cause an Embedded Event Manager (EEM) applet to finish before the show running-config command is executed:
Router(config)#event manager applet shconf
Router(config-applet)#event cli pattern "show running-config" sync yes
Router(config-applet)#action 1.0 syslog msg "Running configuration displayed"
Router(config-applet)#set 2.0 _exit_status 1
This command set configures an EEM applet named shconf that is triggered when the show running-config command is issued. The applet writes a message to syslog and sets the _exit_status to a value of 1. The applet then exits, and the show running-config command is executed.
The event cli command configures EEM to monitor commandline interface (CLI) commands and to trigger the event when a specified pattern is matched one or more times. Events can be processed synchronously or asynchronously. The sync yes keywords are used with the event cli command to configure synchronous processing. With synchronous processing, the EEM applet must finish before the CLI command can be executed, and the _exit_status variable determines whether the CLI command is executed or skipped. If the _exit_status variable is set to a value of 0 or is not configured, the CLI command will not execute after the EEM applet is finished; if the _exit_status variable is set to a value of 1, the CLI command will execute after the EEM applet is finished. For example, the following command set will cause the show running-config command to be skipped because the _exit_status variable is set to a value of 0:
Router(config)#event manager applet shconf
Router(config-applet)#event cli pattern "show running-config" sync yes
Router(config-applet)#action 1.0 syslog msg "Running configuration displayed"
Router(config-applet)#set 2.0 _exit_status 0
The sync no keywords are used with the event cli command to configure asynchronous processing. With asynchronous processing, the EEM applet is processed at the same time the CLI command is executed. When you issue the event cli command with the sync no keywords, you must also include the skip no or skip yes keywords to indicate whether the CLI command should be executed or skipped, respectively. For example, the following command set will cause the EEM applet to run at the same time the show running-config command is executed:
Router(config)#event manager applet shconf
Router(config-applet)#event cli pattern "show running-config" sync no skip no
Router(config-applet)#action 1.0 syslog msg "Running configuration displayed"
The following command set will cause the EEM applet to run and to not execute the show running-config command:
Router(config)#event manager applet shconf
Router(config-applet)#event cli pattern "show running-config" sync no skip yes
Router(config-applet)#action 1.0 syslog msg "Running configuration displayed"