Saturday, February 25, 2012

embedded event manager

router1# config term
router1(config)# event manager environment email_to rich@example.com
router1(config)# event manager environment email_from router1@.example.com
router1(config)# event manager environment email_server 9.9.9.9

Then configure your applet:

router1(config)# event manager applet interface_down
router1(config-applet)# event syslog severity-notification pattern "state Up->;Down"
router1(config-applet)# action 1 syslog msg "INTERFACE_DOWN - Sending email to Support"
router1(config-applet)# action 2 mail server "$email_server" to "$email_to" from "$email_from" subject "INTERFACE_DOWN state changed to DOWN" body "Better Check"
router1(config-applet)# end





To create a loopback and assign an address

R1(config)#event manager applet ADDLOOP
R1(config-applet)#event none sync yes
R1(config-applet)#action 1.0 cli command "enable"
R1(config-applet)#action 2.0 cli command "conf t"
R1(config-applet)#action 3.0 cli command "int loop 0"
R1(config-applet)#action 4.0 cli command "ip add 1.2.3.4 255.255.255.255"
R1(config-applet)#action 5.0 cli command "end"



event manager applet CPU
 event snmp oid cpmCPUTotal5minRev get-type exact entry-op ge entry-val "60" entry-type value poll-interval 60
 action 0.5 cli command "terminal length 12"
 action 1.0 cli command "show processes cpu sorted 5min" pattern "--More--"
 action 1.5 mail server "198.2.5.10" to "engineer@cisco.com" from "EEM@cisco.com" subject "CPUAlert5min" body "$_cli_result"
!
end

event manager applet RICH
 event none
 action 0.5 cli command "terminal length 12"
 action 1.0 cli command "show processes cpu sorted 5min" pattern "--More--"
 action 1.5 syslog msg "$_cli_result"
!
end



 

No comments: