EEM applets
Embedded Event Manager
General information on “EEM applets”:
- Used to automate tasks based on events happening on the network device
- EEM components:
- EEM server: Consists of event detectors/publishers and event subscribers. Triggers a subscriber when a detector/publisher sends a notification about an interesting event (defined by the event subscribers).
- Event detectors/publishers: Monitoring the device for events happening (defined by the event subscribers) and notify the EEM server in case of an interesting event.
- Event subscribers: Scripts that get triggered through the EEM server by an event that happened at one of the event detectors/publishers.
- Possible detectors/publishers:
- Interface: Allows interface parameters to be monitored (eg. threshold violation).
- Routing: Allows routing events to be monitored (eg. routes)
- SNMP: Allows MIB objects to be monitored.
- Syslog: Allows syslogs to be monitored for a specific pattern/string.
- Timer: Allows actions to be executed based on a specific time (eg. cron job).
- Track: Allows tracking objects to be monitored (eg. up/down state).
- […]
- Global variables can be defined to use within all applets
- Actions are executed in lexicographical order (= dictionary order) therefor it’s common to use action 1.0 … action 2.0 … and so on
- Important: EEM starts at the initial USER EXEC mode, therefore the first command should be “enable”!
“EEM applets” configuration steps:
- Define global EEM variables (if needed)
- Create (register) an EEM applet (policy)
- Set event to monitor
- Set action to take in case the monitored event happens
“EEM applets” CLI configuration commands:
## Defining a global EEM variable
Router(config)# event manager environment <name> <value>
## Creating an EEM applet
Router(config)# event manager applet [NAME]
## Setting an event to monitor
Router(config-applet)# event <type> [arguments]
## Setting actions to take
Router(config-applet)# action <number> <type> [arguments]
“EEM applets” example:
Router(config)# track 111 interface Loopback111 line-protocol
Router(config)# event manager applet INTERFACE_TRACKER
Router(config-applet)# event track 111 state down
Router(config-applet)# action 1.0 syslog msg "Interface Lo111 down - EEM will fix this!!!"
Router(config-applet)# action 1.5 wait 2
Router(config-applet)# action 2.0 cli command "enable"
Router(config-applet)# action 2.1 cli command "configure terminal"
Router(config-applet)# action 2.2 cli command "interface lo1111"
Router(config-applet)# action 2.3 cli command "no shutdown"
Router(config-applet)# action 3.0 syslog msg "Interface Lo111 up - Fixed by EEM!!!"