cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1671
Views
0
Helpful
2
Replies

EEM script to trigger high int utilization and snapshot ip flow top-talker

kchengva1
Beginner
Beginner

I would like to know if anyone wrote an EEM script to trigger the high utilization(either in or out) interface.

for example:

if serial1/0 is (inbound or outbound) is 90% utilization, then do "show ip flow top-talker".

2 Replies 2

Ashok Kumar
Cisco Employee
Cisco Employee

Hi,

Here is an example of a policy that will run every 30 seconds look at the output bps and apply a shaped rate to the interface (gig0/0 in this example) that is twice the measured rate. You can modify it as per your needs.

event manager environment qos_intf gig0/0
event manager environment firstrun 0

event manager applet qos
 event timer watchdog time 30
 action 001 if $firstrun eq 0
 action 002  set prate "0"
 action 003  context save key previousrate variable "prate"
 action 010  cli command "enable"
 action 012  cli command "conf t"
 action 013  cli command "event manager environment firstrun 1"
 action 014  cli command "end"
 action 015 end
 action 016 cli command "enable"
 action 020 cli command "show int $qos_intf | inc output rate"
 action 040 regexp "([0-9]+) bits" "$_cli_result" match rate
 action 060 context retrieve key previousrate variable "prate"
 action 065 cli command "conf t"
 action 070 if $rate ne prate
 action 075  multiply $rate 2
 action 080  cli command "policy-map shaper"
 action 090  cli command "class class-default"
 action 100  cli command "shape average $rate"
 action 110  cli command "interface $qos_intf"
 action 120  cli command "service-policy out shaper"
 action 150  syslog msg "Shaper on $qos_intf changed from $prate to $rate bps"
 action 160  set prate "$rate"
 action 170  context save key previousrate variable "prate"
 action 200 end

 

 

event manager applet setfirstrun
 event syslog pattern "SYS-5-RESTART"
 action 010 cli command "enable"
 action 020 cli command "conf t"
 action 030 cli command "event manager environment firstrun 0"

 


- Ashok

******************************************************************************************************

Please rate the post or mark as correct answer as it will help others looking for similar information

******************************************************************************************************

Thank you.

action 040 regexp "([0-9]+) bits" "$_cli_result" match rate

Can you please explain what is "$_cli_result" value from ?

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers