cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1566
Views
0
Helpful
5
Replies

EEM traffic total

ilhem200943
Level 1
Level 1

Hello

I want to create a script that give me total traffic of a switch with embedded event manager. 


anyone help me please

5 Replies 5

Joe Clarke
Cisco Employee
Cisco Employee

Define "total traffic of a switch."  Do you mean a sum of input and output bytes per port?  Backplane traffic?  How would you measure this manually?  What do you want to do with this data?  How should the EEM policy be triggered?

that is to say, I want to make a EEM script that gives me incoming traffic and outgoing traffic and finally I give her total traffic calculation 

this is my mentor who give me this works but I do not know how. 

  Josph thank you for helping me.

I'm still not clear on what you want.  Do you just want the sum of the interface stats to be printed out on the terminal on demand?  How should this policy be triggered?

Hello Joseph

I want to calculate sum of input and output bytes per port.

I did a test: I work with command "show interface f0/0", this command shows us a sentence contains input end output bytes, now if my method is correct how do I extract the value of input and output of this sentence to calculate traffic total.The display is the next :

 30 second input rate 54000 bits/sec, 98 packets/sec
  30 second output rate 0 bits/sec, 0 packets/sec

 

 

Okay, I still don't know how you want to execute this, but I can give you some hints.  I leave it to you to assemble the policy based on your requirements.

 

To get a list of interfaces and sum the total bps, use the following series of actions (note: I assume an applet policy):

 

set itotal 0

set ototal 0

cli command "enable"

cli command "show ip int brief"

set intfs "$_cli_result"

foreach line $intfs "\n"

regexp "^([A-Za-z]+Ethernet[0-9/\.])" $line match intf

if $_regexp_result eq 1

 cli command "show interface $intf | inc rate"

 regexp "input rate ([0-9]+)" $_cli_result match irate

 regexp "output rate ([0-9]+)" $_cli_result match orate

 add $itotal $irate

 set itotal $_result

 add $ototal $orate

 set ototal $_result

end

end

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: