19. SNMP ED Example
Following EEM script run the command when the CPU goes above a certain value.
Configuration:
event manager applet highcpu
event snmp oid " 1.3.6.1.4.1.9.9.109.1.1.1.1.5 " get-type exact entry-op ge entry-val 50 exit-op le exit-val 5 poll-interval 5
action 1.0 cli command "enable"
action 2.0 cli command "show proc cpu sorted"
action 3.0 mail server "58.97.254.49" to "s.sharmin@banglalionwimax.com" from "s.sharmin@banglalionwimax.com" subject "High CPU Alert" body
"$_cli_result"
End
This will poll the five second CPU utilization of the route processor every five seconds. If the
utilization is at or above 50%, the event will fire. The event will not fire again until the CPU drops
below 5%, then goes back to 50%.
The definitions of variables are:
highcpu - name of the event manager applet/script
1.3.6.1.4.1.9.9.109.1.1.1.1.5 / cpmCPUTotal5min - Object identifier (OID) for polling the total CPU utilization of the route processor (RP)
entry-val 50 - CPU utilization that triggers the script
poll-interval 0.5 - Frequency (every 0.5 seconds) the script monitors the CPU
25. EEM Action
event manager applet link-ISP-1-Down
event syslog pattern "1 ip sla 1 reachability Up->Down"
action 1.0 cli command "enable"
action 1.1 cli command "configure terminal"
action 1.2 cli command "no ip nat inside source list 101 interface GigabitEthernet1/0 overload"
action 1.3 cli command "no ip nat inside source list 102 interface GigabitEthernet2/0 overload"
action 1.4 cli command "ip nat inside source list 100 interface GigabitEthernet2/0 overload"
event manager applet link-ISP-1-UP
event syslog pattern "1 ip sla 1 reachability Down->Up"
action 1.0 cli command "enable"
action 1.1 cli command "configure terminal"
action 1.2 cli command "no ip nat inside source list 100 interface GigabitEthernet2/0 overload"
action 1.3 cli command "ip nat inside source list 102 interface GigabitEthernet2/0 overload"
action 1.4 cli command "ip nat inside source list 101 interface GigabitEthernet1/0 overload"
event manager applet link-ISP-2-Down
event syslog pattern "2 ip sla 2 reachability Up->Down"
action 1.0 cli command "enable"
action 1.1 cli command "configure terminal"
action 1.2 cli command "no ip nat inside source list 101 interface GigabitEthernet1/0 overload"
action 1.3 cli command "no ip nat inside source list 102 interface GigabitEthernet2/0 overload"
action 1.4 cli command "ip nat inside source list 100 interface GigabitEthernet1/0 overload"
event manager applet link-ISP-2-UP
event syslog pattern "2 ip sla 2 reachability Down->Up"
action 1.0 cli command "enable"
action 1.1 cli command "configure terminal"
action 1.2 cli command "no ip nat inside source list 100 interface GigabitEthernet1/0 overload"
action 1.3 cli command "ip nat inside source list 102 interface GigabitEthernet2/0 overload"
action 1.4 cli command "ip nat inside source list 101 interface GigabitEthernet1/0 overload"
!
26. Resources
• Support forums for this technology are GREAT
• “Living” documentat https://supportforums.cisco.com/docs/DOC-12757 Contains helpful tips
and tricks to get the most out of EEM .
• For reading material and further resources for this session,visit www.pearson-
books.com/CLMilan2014.
• https://networklessons.com/network-management/cisco-ios-embedded-event-manager/.
• http://www.techtutsonline.com/cisco-ios-embedded-event-manager/
• http://www.cisco.com/c/en/us/td/docs/ios/netmgmt/configuration/guide/12_2sx/nm_12_2sx_bo
ok/nm_eem_overview.htmlfor basic info
• http://www.cisco.com/c/en/us/td/docs/ios/netmgmt/configuration/guide/12_2sx/nm_12_2sx_bo
ok/nm_eem_policy_cli.htmlfor Policies Using the Cisco IOS CLI
• http://www.cisco.com/c/en/us/td/docs/ios/netmgmt/configuration/guide/12_2sx/nm_12_2sx_bo
ok/nm_eem_policy_tcl.htmlfor Policies Using Tcl