An excellent example of using EEM is to shutdown ports at given time (such as disabling VoIP phones after 5pm in the evening, and thus saving electrical power). The code in this example uses the timer cron EEM events to disable an interface. In the following example the DisableInterface applet disables the interface (fa0/1) at 7pm (19:00):
> en # config t (config)# event manager applet DisableInterface (config-applet)# event timer cron name DisableInterface cron-entry "0 19 * * *" (config-applet)# action 1.0 cli command "enable" (config-applet)# action 1.1 cli command "configure t" (config-applet)# action 1.2 cli command "interface fa0/1" (config-applet)# action 1.3 cli command "shutdown" (config-applet)# exit
> en # config t (config)# event manager applet DisableInterface (config-applet)# event ? application Application specific event cli CLI event counter Counter event interface Interface event ioswdsysmon IOS WDSysMon event none Manually run policy event oir OIR event snmp SNMP event syslog Syslog event timer Timer event (config-applet)# ev t ? absolute Absolute timer event countdown Countdown timer event cron Cron timer event watchdog Watchdog timer event (config-applet)# ev t cro ? cron-entry Cron entry for cron timer name Name of the timer (config-applet)# ev t cro nam ? WORD Timer name string (config-applet)# ev t cro nam DisableInterface ? cron-entry Cron entry for cron time (config-applet)# ev t cro nam DisableInterface c ? WORD Cron entry string (config-applet)# event timer cron name DisableInterface cron-entry "0 19 * * *" (config-applet)# action 1.0 cli command "enable" (config-applet)# action 1.1 cli command "configure t" (config-applet)# action 1.2 cli command "interface fa0/1" (config-applet)# action 1.3 cli command "shutdown" (config-applet)# exit