VMmanager Knowledge Base

How to limit VM bandwidth when traffic threshold is exceeded?

This article contains instructions on how to limit the bandwidth (incoming and outgoing traffic speeds) of a VM if the VM exceeds its traffic consumption. 

The current version of the VMmanager 6 processing module in the BILLmanager 6 platform does not support the bandwidth limitation function. You can implement this function using a separate Python script. The script remotely connects to the platform and changes settings of VMs that have exceeded traffic consumption.

Scripts requirements

  • The script can run on any server that has access to the platform using the HTTPS protocol.
  • To run the script, you will need to specify the platform administrator's e-mail and password.
  • For the script to run, an SSL certificate must be connected to the domain name of the platform.

Setting restrictions

To set the limits for the bandwidth of the channel:

  1. Prepare the environment for running Python scripts. See the official Python documentation for details.
  2. Create a python script called limits.py

    Script content
  3. Run the script:

    python3 limits.py --url <platform_url> --email <admin_email> --password <admin_pass> --vmid <vm_id> --threshold-gib <threshold> --limit-mbitps <limit>
    Comments to the command