Skip to content

cdalamagkas/ovsmirrorwatch

Repository files navigation

OVSMirrorWatch 👀 - An Open vSwitch Mirror Monitor tool

This is a Django-based web application that monitors OVSDB managers and restores their port mirroring configurations.

In Open vSwitch (OVS), port mirroring configurations are lost when the system reboots, and permanently breaks when a participating interface is removed. So, each time a port mirroring breaks or deleted, the system administrator should re-create again the port mirroring configurations. The same problem appears in cloud environments, e.g. in Proxmox VE.

To address this issue, OVSMirrorWatch allows the administrator to define port mirroring sessions, and then it queries periodically the OVSDB managers to ensure that the port mirroring sessions are present. If a port mirroring session breaks (due to a hard reboot of a VM or a downtime of some VMs), OVSMirrorWatch tries periodically to re-establish the port mirroring session. OVSMirrorWatch always ensures that the stateful mirroring configuration that the administrator defines in OVSMirrorWatch's DB, is reflected to the live and stateless enviroment of the OVSDB managers.

Deployment from source code

If this is the first time running the project, you need to prepare the python environment and install the dependencies from requirements.txt. Also, make sure you are using Python 3.10.

If you do not have Python 3.10 in your system, issue the following commands on an Ubuntu machine:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.10 python3.10-venv

Then, create a Python environment and activate it:

python3.10 -m venv venv
source ./venv/bin/activate

In your Python environment, install the dependencies in requirements.txt and (manually) the python-ovs-vsctl package:

pip install -r requirements.txt
pip install git+https://github.com/iwaseyusuke/python-ovs-vsctl.git

A .env file must be created (not included in git), which defines all the initial configurations that Django needs in order to start. The .env must have the following content:

OVSMW_SECRET_KEY=<Django secret>
OVSMW_DEBUG=<0 or 1>
OVSMW_DJANGO_STATIC_FILES_PROXIED=<0 or 1>
OVSMW_REDIS_BROKER_HOST=<You can use docker-lab.trsc.net or your own Redis server>
OVSMW_REDIS_BROKER_PORT=<Usually 6379>
DJANGO_SUPERUSER_USERNAME=<Provide a username for the built-in superuser>
DJANGO_SUPERUSER_PASSWORD=<Provide the password of the built-in superuser>
DJANGO_SUPERUSER_EMAIL=<Provide the email of the built-in superuser>

Redis is an essential component, it is required by Django Celery, Celery Beat and Django Channels!

Activate the virtual enviroment:

source ./venv/bin/activate

Load the environment variables

export $(cat .env | xargs)

If this is the first time starting the project, apply the migrations (also apply them every time the migrations are updated):

python manage.py migrate

If this is the first time starting the project, create a superuser:

python manage.py createsuperuser --noinput

Start the Celery worker in one window

celery -A ovsmirrorwatch worker -l info

In another window or terminal tab, load again the environment variables, and start the Celery Beat

celery -A ovsmirrorwatch beat -l info --scheduler django

Only for development purposes only, you can run the worker and beat with a single command:

celery -A ovsmirrorwatch worker --beat --scheduler django --loglevel=info

Finally, in another terminal window/tab, load again the environment variables and start the Django development server

python manage.py runserver 0.0.0.0:8000

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published