UNX511/DPS912 - Assignment 1: A Network Monitor

Lecture recording here.

Due: Sunday, July 21, 2024

Business Case (Marketing, Project Manager, Senior Executives)

Your job will be to create a network monitor, which monitors the performance of all network interface devices. Monitoring network interfaces can help in debugging system problems as well as in enhancing system performance through a central intelligent networking device.

Currently on our virtual machine, we have two network interfaces: ens33 and lo. On other machines such as routers, there may be as many as 64 network interfaces, some of them running in the order of 10GBits/second. For routers and other networking equipment, it is crucial to know the performance of each interface and to control each interface, therefore we are going to create a network monitor.

Requirements (Marketing, Project Manager, Project Lead)

  1. Our network monitor must be able to monitor any set of network interfaces requested by the user.
  2. The statistics for each network interface can be found under Linux's /sys directory, specifically /sys/class/net/<interface-name>. The /sys directory is another directory like /proc and /dev which can be accessed to set or obtain information about the kernel's view of the system.

    The statistics to be monitored are:
    The operating state - operstate
    The up-count (number of times the interface has been up) - carrier_up_count
    The down-count (number of times the interface has been down) - carrier_down_count
    The number of received bytes - rx_bytes
    The number of dropped received bytes - rx_dropped
    The number of erroneous received bytes - rx_errors
    The number of received packets - rx_packets
    The number of transmitted bytes - tx_bytes
    The number of dropped transmitted bytes - tx_dropped
    The number of erroneous transmitted bytes - tx_errors
    The number of transmitted packets - tx_packets
  3. If an interface goes down (see operstate) then your network monitor must set it back up.
  4. Your network monitor must shut down gracefully. That means it must intercept a ctrl-C to shutdown the program. The shutdown might include the following - close file connections, deallocate memory, etc...
  5. The network monitor will act synchronously. It will not instantly react to any changes in the statistics. Rather, it will poll the statistics every one second.
  6. Your network monitor will print out the following once every second for each network interface:
    Interface:<interface-name> state:<state> up_count:<up-count> down_count:<down-count>
    rx_bytes:<rx-bytes> rx_dropped:<rx-dropped> rx_errors:<rx-errors> rx_packets:<rx-packets>
    tx_bytes:<tx-bytes> tx_dropped:<tx-dropped> tx_errors:<tx-errors> tx_packets:<tx-packets>
  7. For a bonus mark, you can have the statistics displayed on a web page. See week 7 of our lecture notes on setting up the Apache2 web server to work within a Linux environment.

Design (Project Lead, Senior Engineers)

There are two parts to the design - the interface monitor and the network monitor itself. There may be one or more interface monitors but there is only one network monitor.

The Interface Monitor
Each interface will have a process dedicated to it. This is called the interface monitor. For instance, if there are three network interfaces on a Linux machine, three instances of the interface monitor process will be running. Each interface monitor will:

The Network Monitor
The network monitor controls all interface monitors running on the system. In a software defined network, it is common to centralize all intelligence in one spot in order to coordinate the operations of all network devices. In our case, intelligence is centralized in the network monitor and the work is done by the interface monitors. The network monitor will:

Implementation (Junior and Senior Engineers)

Testing and Rework (Junior and Senior Engineers, Product Support)

Questions

  1. In a few sentences, describe the general architecture of your entire layout with the network monitor and interface monitors. What does each do? [0.5 mark]
  2. Could the interface monitor and network monitor all be contained within one process, if so how? [0.5 mark]
  3. Could the interface monitor and network monitor all be contained within one process, assuming 128 network interfaces running at several Giga-bits per second, which require a polling interval of one millisecond per interface. [0.5 mark]
  4. What is a software defined network? In doing so, describe the applications layer, the control layer, and the forwarding layer. [1.5 marks]

Timeline

Days 1-7: Complete and test the interface monitor as a stand-alone unit.

Days 8-14: Complete the network monitor with socket interface to the interface monitor.

Days 15-21: Test and Rework. Answer Questions. Submit Assignment.

Marking Rubric

Assignment 1 is worth 15% of your final grade and as such is marked out of 15. You will get a bonus mark if you can display statistics on a webpage, but your final mark cannot exceed 15/15. Below is the rubric for the assignment:

Does not meet expectationsSatisfactoryGoodExceeds Expectations
Network Monitor
(6 marks)
Does not meet requirementsMeets the most important requirementsMeets all requirements with minor errorsMeets all requirements with no errors
Interface Monitor
(5 marks)
Does not meet requirementsMeets the most important requirementsMeets all requirements with minor errorsMeets all requirements with no errors
Documentation
(1 mark)
Does not contain documentationContains header documentation for either all files or for all functions within each file Contains header documentation for all files and for most functions within each fileContains header documentation for all files and for all functions within each file. Documents unclear code.
Questions
(3 marks)
Answers no question correctlyAnswers some questions correctly Answers most questions correctlyAnswers all Questions correctly
Webpage Display
(bonus 1 mark)
Does not display statistics...Displays statistics...

Submission

Please email all source code and answers to questions to: shahdad.shariatmadari@senecapolytechnic.ca

Your questions can be submitted in a separate document or embedded within your source code.

Late Policy

You will be docked 10% if your assignment is submitted 1-2 days late.
You will be docked 20% if your assignment is submitted 3-4 days late.
You will be docked 30% if your assignment is submitted 5-6 days late.
You will be docked 40% if your assignment is submitted 7 days late.
You will be docked 50% if your assignment is submitted over 7 days late.