Kai McGregor
Raleigh NC, USA
Video Demo: https://youtu.be/BXW23sRfkRs
This is a django webserver for querying and displaying network traffic data from switches. Switch traffic is queried through telnet connections by sending the provided query to the switch and matching it with a provided regex to return input and output rates and units. This is done to provide flexibility in the software being run on the switch, but comes at the cost of a more involved setup process.
Graph display is done through Chart.js while bootstrap provides a clean layout and interface.
Scheduling is done through the python threading class and utilizes timers for low-overhead. This method was chosen over cron jobs and pythons Celery library as it is platform independant and doesn't require the additional setup of workers.
Underlined fields are required
- Name: the name, used for display purposes
- Interval: an HH:MM:SS time interval to poll the switch at
- Autostart: a boolean that indicates whether to start polling at server startup
- Address: the domain or ipv4 address of the switch
- Username: the username to access the switch
- Password: the password to access the switch, this is encrypted with a unique key at rest
- Switch: the switch on which to run the command
- Protocol: the protocol to use to connect, currently only telnet is supported
- Port: the port on which to access the switch
- Query: the command to send to the switch that will return input and output rates and units
- Query Regex: a regex that will match and place the input and output rates and units in named capture groups
- To name a regex capture group, place "?P<capture_name>" at the start of your capture groups, where your capture names would be input_unit, input_rate, output_unit, and output_rate
- Rate: a boolean that indicates whether the returned data should be interpreted as a rate
- Query Interval: the interval of time the query covers
- Bash Prompt: the bash prompt displayed by a telnet connection
- Login Prompt: the login prompt displayed by a telnet connection
- Password Prompt: the password prompt displayed by a telnet connection
- Switch: the switch the device is connected to
- Name: the name, used for display purposes
- Port: the port, as identified by the switch and placed in the query when a command is sent
- static: contains static css and javascript files
- templates: contains html template files utlizing the django template language and its features
- templatetags: contains a template tag for accessing items dictionary items by key with the django template language
- apps.py: contains startup code for initializing the static object that holds the switch query process objects
- connections.py: python code for querying switches over different protocols, currently only telnet
- forms.py: django objects that aid in displaying and processing user input information
- models.py: django objects representing tables in a database
- scheduler.py: contains a class for scheduling switch queries and a static class for holding and syncing access to said objects
- urls.py: contains the registered paths for the application
- validators.py: contains database field validators
- views.py: code to provide response to http requests
- settings.py: contains server settings such as the database connection and password encryption key
- urls.py: contains the registered paths for the application