CS615A Aspects of System Administration Homework Assignment #3 Please read this entire document before starting to work on the assignment. Goals: ------ To gain an understanding of SNMP as well as to write a tool that follows specific requirements. Summary: -------- This assignment consists of a single program to determine the bandwidth usage of a given host via SNMP. Due date: --------- 2009-04-19 10:59:59 Meta: ----- You may chose any programming language you like to write this program. However, the program needs to run (without any additional software installed or any special settings or tweaks) on all three of the systems you have been given access to: - linux-lab.cs.stevens.edu Linux (Fedora release 8) - lab.cs.stevens.edu NetBSD 2.1 - drude.cs.stevens.edu Solaris 10 The program will be executed as "./bwinfo" and needs to work using this invocation. Feel free to discuss general problems and concepts on the mailing list or amongst yourself, but please do not share any significant code snippets or detailed step-by-step instructions. Each of you should learn to do this on their own. Each of your program should follow general UNIX philosophy and act and behave following the principle of least surprise. Details: -------- Functional requirements: ------------------------ Write a program that determines a given hosts network interfaces' bandwidth usage via SNMP. The program has the following usage: bwinfo [-h] [-c community] [-i interface] [-t time] hostname -c community use the given community string -h print a short usage summary and exit -i interface only generate output for the given interface -t time use the given number in seconds in between pools If the '-c' flag is not specified, your tool will default to using the string "public". If the '-i' flag is not specified, your tool will generate stats for each interface on the given host. If the '-t' flag is not specified, your tool will default to using 60 seconds. If no hostname is given, your tool will generate the above usage and exit. If more than one hostname is given, your tool will generate the above usage and exit. If any additional flags are given, your tool will generate the above usage and exit. Your program will use SNMP to query the given host, determine all network interfaces on the host and calculate the current bandwidth usage. That is, it will determine the number of packets sent and received on each interface, then wait the given number of seconds, query the host again and calculate the usage in Mb/s. The output of your tool will be: \t\t \t\t [...] \t\t (where "\t" is a tab character). Your tool will not generate any other output on stdout. Any errors encountered will be reported on stderr. If your tool does not encounter any errors, it will exit with an exit status of 0. Otherwise, it will exit with an exit status greater than 0. Hosts you should test this against: The following hosts allow you to query them via SNMP and you should test your program against all of them: 3com4200.cs.stevens-tech.edu -- community string 'public' colt45.cs.stevens.edu -- community string 'public' drude.cs.stevens.edu -- community string 'public' medusa.srcit.stevens.edu -- community string 'cs615' ups0.cs.stevens-tech.edu -- community string 'public' If you have *any* questions, please ask on the class mailing list. Do *not* assume anything. Do *not* implement a specific behaviour if you're not sure it's correct. Deliverables: ------------- You need to send me an email from your Stevens account with your homework submission as an attachment. If you do not use your Stevens account, you will lose 5 point. If you do not use the subject line "[cs615] hw3 submission", you will lose 5 point. If your email does not contain an attachment, you will lose 5 point. If the attachment is not named $username.tar.gz (where $username is your Stevens username), you will lose 5 point. The attachment must be a compressed tarball extracting exactly into a directory named $username (where $username is your Stevens username). If your submission extracts any other directories, you lose 5 point. Your submission will extract a file "$username/bwinfo" (where $username is your Stevens username). It may also extract a file 'README' or, if you chose a compiled language, a Makefile and a single source file from which to build the 'bwinfo' tool. If your submission includes any other files, you lose 5 point. References: ----------- The manual pages and documentation of whatever programming language you chose. snmpcmd(1) http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol