Skip to content

naturalnetworks/mtqosadj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DSL Bandwidth Management Script

This script retrieves Downstream and Upstream attainable rates from a DSL modem via SNMP, calculates proposed Queue Tree Max Limits for Mikrotik RouterOS, and sets these limits. Configuration is loaded from a JSON file or environment variables.

The max limit is calculated as a percentage of the current rate - in this case, 10% of headroom is allowed for to suit a CAKE/FQ-CODEL queue.

Table of Contents

Dependencies

  • pysnmp: SNMP library for Python (pysnmp)
  • routeros_api: MikroTik RouterOS API for Python (routeros_api)

Installation

  1. Clone the repository:

    git clone https://github.com/naturalnetworks/mtqosadj.git
    
  2. Create a Python Virtual Environment

    cd mtqosadj
    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    

Configuration

Edit config.json to set SNMP and RouterOS parameters. Alternatively, use environment variables for sensitive information.

Usage

Run the script with the necessary permissions to read SNMP information from the DSL modem and set Queue Tree Max Limits on the MikroTik RouterOS.

/path/to/mtqosadj/.venv/bin/python3 /path/to/mtqosadj/main.py

Example contab entry

*/30 * * * * user cd /path/to/mtqosadj && /path/to/mtqosadj/.venv/bin/python3 /path/to/mtqosadj/main.py

Example log ouput

INFO: Download/Upload Queue CURRENT Max Limit: 45609063/9738548
INFO: Setting Queue "download" Max Limit to 45609063
INFO: Setting Queue "upload" Max Limit to 9738548
INFO: Download/Uploads Queue APPLIED Max Limits: 45609063/9738548 (45609.06/9738.55 kbps)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages