Network Management Programming Project Dordal, Summer I, 2005 You are to build a tool in java that uses SNMP to do the following. You can experiment with interactive tools such as the iReasoning tool or SNMP Inquisitor, but your final program should do a complete "run" with no further interactive input. 1. Starting with host ulam.math.luc.edu, DISCOVER the subnet it is on and any other machines on that network. One can do this using several techniques, and use of ping is one such. However, a slicker way to discover machines on a subnet is to make use of the ARP table on ulam (the Address Translation, or "at" table, 1.3.6.1.2.1.3). 2. After you collect a list of machines on the subnet, collect usage data by POLLING at regular intervals. Start with a polling interval of 1 minute (denoted TIMEINTERVAL below), and run the polling 5 times (I will raise that to 60 when I test your program; you may on the other hand want a lower value than 5 for development testing). In 1 minute, fast ethernet can transfer about 700MB; that is, the 32-bit bandwidth counters won't lose track. (They may wrap around, but at most once. Be sure your program properly handles wrapping around from high to low!) Use the Interfaces, TCP, and UDP groups to collect the following statistics: Total in and out bandwidth, for the last TIMEINTERVAL. Total in and out packets Percentage of in and out packets that are UDP Percentage of in and out packets that are TCP (these two should add up to *almost* 100%) Most machines will have two interfaces, one ethernet and one loopback. Report statistics for each interface separately! For part 1, you will make the appropriate call to retrieveMIBTable for the at table. You will then have to figure out how this table is indexed. Doing this literally can be confusing, as it is indexed by IP address. HOWEVER, once you find the subtree with prefix mib2.3.1.1.3.2.1, the IP addresses are used as the balance of the OID, eg mib2.3.1.1.3.2.1.147.126.2.5. Actually, if you just retrieve the table with prefix OID mib2.3.1.1.3.2.1 (remember mib2 == 1.3.6.1.2.1), you will get a set of entries the OIDs of which consist of the above-named prefix OID followed by IP addresses, eg 1.3.6.1.2.1.3.1.1.3.2.1.147.126.2.9 (Note that the AT table is also now in the IP group, as ipNetToMediaTable. The table there is in pretty much the same format as in AT.) Here is the algorithm for hostname acquisition described in class. Assume you have a function GetIPs(InetAddress A) that returns a list of all IP addresses in the ARP table of host A, using SNMP to make the query. (If A is not an SNMP speaker, then GetIPs returns an empty list; the algorithm here still works though.) Let T be a table of InetAddresses, with T[0] = 147.126.2.5 (ulam). Proceed as follows: i=0 while ( i < T.size() ) { Alist = GetIPs(T[i]); //Add entries in Alist to T *if* they are not already there: for (a in Alist) if (! T.ismember(a)) T.append(a) i++; } Done this way, you don't even need a second field in T to indicate if you've done the GetIPs operation on T(i). This algorithm amounts to breadth-first search with removal of duplicates. =============== You will have to download the Java SNMP library on my web page. If necessary, I can provide you with the compiled jar file as well. Eclipse is pretty good about letting you use jar files as project libraries, but with bare-bones javac (java compiler) I had to create a directory "snmp" in my work directory with java *source* code for the snmp library! Output should be a list of stats for each machine discovered in the discovery phase. Your program should clearly distinguish internally between the discovery and data-collection phases; at the very least, the two should be in different functions. The discovery phase will return a list (or array) of IP addresses. InetAddress [] hosts = discover(ulam); ??? stats = get_statistics(hosts); Or something like that. I will keep you posted on snmp passwords. Expect to have to try multiple passwords (only one will work) for a given host.