Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

EEM traffic total

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
Cisco Employee

Define "total traffic of a

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?

New Member

that is to say, I want to

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.

Cisco Employee

I'm still not clear on what

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?

New Member

Hello JosephI want to

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

 

 

Cisco Employee

Okay, I still don't know how

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

186
Views
0
Helpful
5
Replies