Sunday, April 6, 2008

EEM - Syslog Pattern Matching

The following example EEM applet trigger when the router generates the following configuration change syslog message:

%SYS-5-CONFIG_I: Configured from console by cisco on console

EEM Applet:
event manager applet foobar
event syslog pattern “.*%SYS-5-CONFIG_I.*”
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show ip route | append flash:show_tech"
action 1.4 cli command "show ip interface brief | append flash:show_tech"
action 1.5 cli command "more flash:show_tech"
action 1.6 syslog msg "Sending foobar output..."
action 1.7 mail server $_email_server to $_email_to from $_email_from subject "Foobar Output" body
action 1.8 syslog msg "Foobar output sent!"

router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Hit cntl-C to break out
*Sep 13 06:17:13.146: %SYS-5-CONFIG_I: Configured from console by cisco on console
*Sep 13 06:17:14.018: %HA_EM-6-LOG: sendtech: Sending foobar output...
*Sep 13 06:17:15.810: %HA_EM-6-LOG: sendtech: Foobar output sent!

No comments: