Examining Links via SNMP
We need the values of three objects to plug into the above formulae:
- The number of bytes (octets) received at if2
- The number of bytes (octets) sent from if2
- The speed of if2
Listing 1 illustrates a DOS batch file (called get.bat) that calls into the C++ program to retrieve the above objects.
Listing 1 DOS Batch File
Debug\facade.exe GET MyHostPC public .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.1 Debug\facade.exe GET MyHostPC public .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.1 Debug\facade.exe GET MyHostPC public .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifSpeed.1 Pause
Listing 1 illustrates three calls to a program created in [1]. The first call retrieves the values of ifInOctets, ifOutOctets, and ifSpeed of our given interface (if2 in Figure 1).
Listing 2 illustrates the output generated by executing the batch file. Lines in Listing 2 that begin with ">" indicate system responses.
Listing 2 Retrieving the Counter and Interface Speed Objects
E:\C++ Infrastructure\Facade>get E:\ C++ Infrastructure\Facade>Debug\facade.exe GET MYHOSTPC public .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.1 >The current date and time are: Sat Mar 12 20:12:42 2005 >SNMP Operation Type GET >MIB Object Instance = interfaces.ifTable.ifEntry.ifInOctets.1 >Type and Value = Counter - 4906 E:\C++ Infrastructure\Facade>Debug\facade.exe GET MYHOSTPC public .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets.1 >SNMP Operation Type GET >MIB Object Instance = interfaces.ifTable.ifEntry.ifOutOctets.1 >Type and Value = Counter - 5048 E:\C++ Infrastructure\Facade>Debug\facade.exe GET MYHOSTPC Public .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifSpeed.1 >The current date and time are: Sat Mar 12 20:12:43 2005 >SNMP Operation Type GET >MIB Object Instance = interfaces.ifTable.ifEntry.ifSpeed.1 >Type and Value = Gauge - 10000000
Listing 2 illustrates the three required objects marked in bold as well as a time stamp:
- The number of bytes (ifInOctets) received at if2—4906
- The number of bytes (ifOutOctets) sent from if2—5048
- The speed (ifSpeed) of if2—1000,000 bps (or 1Mbps)
- Time stamp—Sat Mar 12 20:12:42 2005
This is our first baseline measurement. Now, we run the same program again and we get the second required measurement (not shown). Let's say the data from the second run are the following:
- The number of bytes (ifInOctets) received at if2—200408
- The number of bytes (ifOutOctets) sent from if2—189096
- The speed (ifSpeed) of if2—1000,000 bps (or 1Mbps)
- Time stamp—Sat Mar 12 20:12:52 2005
The difference between the time stamps is 10 seconds. Let's now plug these data into the two formulae:
Incoming Link Utilization = (200408 – 4906) * 8 * 100 / 1000000 * 10 = 15.64 % Outgoing Link Utilization = (189096 – 5048) * 8 * 100 / 1000000 * 10 = 14.73 %
So, we have utilization figures of nearly 16 percent and 15 percent, respectively. These are fairly high and might indicate that the link in question is insufficient for the traffic passing across it. Further analysis is justified and can be carried out by running the program over a longer period of time (say, one hour).