This document describes how to calculate bandwidth use with Simple Network Management Protocol (SNMP).
There are no specific requirements for this document.
This document is not restricted to specific software and hardware versions.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.
For more information on document conventions, refer to the Cisco Technical Tips Conventions.
It is sometimes necessary to calculate bandwidth use with SNMP.
Use this solution to solve this problem.
How you calculate use depends on how data is presented for what you want to measure. Interface use is the primary measure used for network use. Use this formulas, based on whether the connection you measure is half-duplex or full-duplex. Shared LAN connections tend to be half-duplex, mainly because contention detection requires that a device listen before it transmits. WAN connections are full-duplex because the connection is point-to-point; both devices can transmit and receive at the same time because they know there is only one other device that shares the connection. Because MIB-II variables are stored as counters, you must take two poll cycles and figure the difference between the two (hence, the delta used in the equation).
This explains the variables used in the formulas:
Note: ifSpeed does not accurately reflect the speed of a WAN interface.
For half-duplex media, use this formula for interface use:
It is more challenging to calculate for full-duplex media. For example, with a full T-1 serial connection, the line speed is 1.544 Mbps. Therefore, a T-1 interface can both receive and transmit 1.544 Mbps for a combined possible bandwidth of 3.088 Mbps!
When you calculate the interface bandwidth for full-duplex connections, you can use this formula, where you take the larger of the in and out values and generate a use percentage:
However, this method hides the use of the direction with the lesser value and provides less accurate results. A more accurate method is to measure the input use and output use separately, with this formula:
These formulas are simplified because they do not consider overhead associated with the protocol. For example, refer to RFC 1757 Ethernet-utilization formulas that consider packet overhead.
All of the MIB attributes listed are also in RFC1213 MIB.
Details of the MIB variables used in these formulas are:
.1.3.6.1.2.1.2.2.1.10 ifInOctets OBJECT-TYPE -- FROM RFC1213-MIB, IF-MIB SYNTAX Counter MAX-ACCESS read-only STATUS Mandatory DESCRIPTION "The total number of octets received on the interface, including framing characters." ::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) interfaces(2) ifTable(2) ifEntry(1) 10 } .1.3.6.1.2.1.2.2.1.16 ifOutOctets OBJECT-TYPE -- FROM RFC1213-MIB, IF-MIB SYNTAX Counter MAX-ACCESS read-only STATUS Mandatory DESCRIPTION "The total number of octets transmitted out of the interface, including framing characters." ::= { ISO(1) org(3) DOD(6) Internet(1) mgmt(2) mib-2(1) interfaces(2) ifTable(2) ifEntry(1) 16 } .1.3.6.1.2.1.2.2.1.5 ifSpeed OBJECT-TYPE -- FROM RFC1213-MIB, IF-MIB SYNTAX Gauge MAX-ACCESS read-only STATUS Mandatory DESCRIPTION "An estimate of the interface's current bandwidth in bits per second. For interfaces which do not vary in bandwidth or for those where no accurate estimation can be made, this object should contain the nominal bandwidth." ::= { ISO(1) org(3) DOD(6) Internet(1) mgmt(2) mib-2(1) interfaces(2) ifTable(2) ifEntry(1) 5 }