Sample

The main objective of this challenge is to set EEM. A sample configuration is:

> en
# config t
(config)# event manager applet test 
(config-applet)# event syslog pattern "interface fastethernet0/1, changed state to down"
(config-applet)# action 1.0 cli command "enable"
(config-applet)# action 1.1 cli command "configure term"
(config-applet)# action 1.2 cli command "interface fa/01"
(config-applet)# action 1.3 cli command "no shutdown"
(config-applet)# exit

EEM is a powerful tool which a rich array of events, with a wide range of associated actions. In this case the event detected is Fa0/1 going into the down state, when the status message of:

"Interface FastEthernet0/1, changed state to down"

is added to Syslog. After this the following code is then used to configure the device:

enable
configure term
interface fa0/1
no shutdown

which should force fa0/1 back into the no shutdown state.

Example

> en
# config t
(config)# event ?
  manager  Event Manager configuration commands
(config)# event manager ?
  applet       Register an Event Manager applet
  directory    Set Embedded Event Manager directory information
  environment  Set an Embedded Event Manager global environment variable
  history      Set Embedded Event Manager history information
  policy       Register an Embedded Event Manager policy
  scheduler    Set Event Manager scheduler options
  session      Set Embedded Event Manager session attributes
(config)# event manager applet ?
  WORD  Name of the Event Manager applet
(config)# event manager applet DETECT
(config-applet)#?
Event Manager Applet Entry Configuration Commands:
  action  Add or modify an action statement
  event   Add or modify event information
  exit    Exit from Event Manager applet configuration submode
  help    Description of the interactive help system
  no      Negate a command or set its defaults
  set     Set a variable 

(config-applet)# event syslog pattern ?
  WORD  Pattern match string

(config-applet)# event syslog pattern "Interface FastEthernet0/1, changed state to down"
(config-applet)# action ?
  WORD  Label
(config-applet)# action 1.0 ?
  cli               Execute a CLI command
  cns-event         Send a CNS event
  counter           Modify a counter value
  force-switchover  Force a software switchover
  info              Obtain system specific information
  mail              Send an e-mail
  policy            Run a pre-registered policy
  publish-event     Publish an application specific event
  reload            Reload system
  snmp-trap         Send an SNMP trap
  syslog            Log a syslog message

(config-applet)# action 1.0 cli ?
  command  CLI command
(config-applet)# action 1.0 cli command ?
  WORD  CLI string
(config-applet)# action 1.0 cli command "enable"
(config-applet)# action 1.1 cli command "configure term"
(config-applet)# action 1.2 cli command "interface fa/01"
(config-applet)# action 1.3 cli command "no shutdown"
(config-applet)# exit