I want to find per-port bandwidth usage of switch (CISCO 2950) using SNMP. I tried ifInOctets
, ifOutOctets
, ifSpeed
but i dont know it is true or not?
I do snmpget for port 1 and the Result was
Result
ifInOctets = 3404696928
ifOutOctets = 1813440596
ifspeed = 100000000
bandwidth in Mbs is my problem
Best Answer
The table OID 1.3.6.1.2.1.2.2.1 contains all important network interfaces objects. You found the right objects
ifInOctets
(1.3.6.1.2.1.2.2.1.10)/ifOutOctets
(1.3.6.1.2.1.2.2.1.16) for tracking received/transmitted octets to/from the interface. If you need to get such statistics per port you need to append an index of port to the table OID, e.g.1.3.6.1.2.1.2.2.1.10
.1 for received octets of port 1 and1.3.6.1.2.1.2.2.1.16
.1 for transmitted octets.With such data, you are already able to calculate input/output utilization per port with simple formulas
You get received/transmitted octets per second as a result. You can either write your own script and to incorporate it in your monitoring tool or you can leverage 3rd party tools like Nagios, Cacti, Munin, Mrtg and so on to do such calculations automatically and present them in nice graphs.