BILLmanager allows you to limit the traffic speed of a virtual server ordered in VMmanager 6. The speed is reduced to the specified value when the traffic quota is exceeded. The limit can be set for:
- incoming traffic — internal name in;
- outgoing traffic — internal name out.
When a client's traffic quota is exhausted, BILLmanager notifies VMmanager 6. VMmanager 6 lowers the client's connection speed to the "free" speed — the minimum speed at which the client can continue using services. This option allows the provider to efficiently manage client traffic, and allows the client to continue using the service without exceeding quotas and reduce the cost of the virtual server service.
Setting in the interface
To configure traffic restrictions for a tariff plan, go to Products → Tariff plans → select a tariff → click Options button → Traffic → activate the Speed limitation in case of overage option.
You can specify the following limits:
- Tariff plan includes — the amount of traffic included in the cost of the "Traffic" add-on tariff plan. After the client uses the specified amount,speed restrictions are applied.
- Maximum value — the maximum traffic volume a client can order. After this amount is consumed, the service will be suspended until the next billing period. The traffic measurement unit is selected in the tariff plan settings. GiB is used by default. For details, see About tariff plan configuration.
For more details on configuring speed limits for exceeded traffic in the interface, see VMmanager 6 Tariff Plan.
Setting a limit
Enabling the restriction
The restriction is activated after statistics are collected by the statdaily
command. By default, this command runs automatically via the billmaintain
mechanism:
- task name —
billstat
; - execution time — 00:20 (server time).
To run the mechanism manually, execute the command:
/usr/local/mgr5/sbin/billmaintain --command billstat --module 123 --date 2025-12-30
To manually trigger a forced daily check and apply restrictions for a service on a specific date, run:
/usr/local/mgr5/sbin/mgrctl -m billmgr service.statdaily item=123 statdate=2025-12-30 force=on
Removing the restriction
The removal of the restriction depends on the tariff plan settings and occurs under one of the following conditions:
- start of a new billing period — the restriction is lifted automatically via
statdaily:
- for monthly statistics — on the 1st day of the next month;
- for daily statistics — on the next day.
- payment for overage — the restriction is removed when the following conditions are met sequentially:
- processing callbacks for modifying or deleting charges;
- no unpaid charges for the service (if the client has paid for the overage or the administrator has cleared the debt).
For detailed information on the conditions for lifting restrictions, see the description of the Speed limitation in case of overage option in the VMmanager 6 Tariff Plan article.
If the restriction is set to be lifted at the start of a new billing period, you can remove it without waiting for the 1st of the next month. To do this, add to the configuration file /usr/local/mgr5/etc/billmgr.conf the following line: Option BillTestMode
. This line will prevent speed limiting and disable any existing restrictions.
To check if Option BillTestMode
is enabled, run the command:
/usr/local/mgr5sbin/mgrctl -m billmgr optionlist
For more details on the configuration file, see Configuration file.
Restriction data storage
Restriction data is stored in the database in the item_limitation
table in the item
and addon
columns, where:
item
— id of the main service;addon
— id of the add-on (traffic) that triggers the restriction. Primary key.
Both columns reference the item
table. A record in the table means there's an active restriction for the add-on. The record is deleted when the restriction is lifted.
The pmvmmgr6 module
The pmvmmgr6 module enables and disables restrictions using the following commands:
- enabling restriction:
/usr/local/mgr5/processing/pmvmmgr6 --command stat_limit_activate --item 123 --addonintname bandwidth
After executing a command, the VMmanager 6 log will display the following message:
DEBUG: New limited throughput: inbound traffic = 7 Mbps, outbound = 4 Mbps
DEBUG: POST query to 'vm/v3/host/12345/resource': {
"net_in_mbitps" : 7,
"net_out_mbitps" : 4
}
...
DEBUG: Throughput has been limited for item#123
- disabling restriction:
/usr/local/mgr5/processing/pmvmmgr6 --command stat_limit_deactivate --item 123 --addonintname bandwidth
After executing a command, the VMmanager 6 log will display the following message:
DEBUG: New regular throughput: inbound traffic = 70 Mbps, outbound = 60 Mbps
DEBUG: POST query to 'vm/v3/host/12345/resource': {
"net_in_mbitps" : 70,
"net_out_mbitps" : 60
}
...
DEBUG: Throughput limit has been lifted from item#123
These commands implement traffic limiting on the VMmanager 6 side. BILLmanager communicates with VMmanager 6 using the above commands.
Speed limit values are taken from fields in the Traffic add-on tariff plan:
- Incoming traffic limit, Kbps — if empty, value is taken from Incoming traffic, Kbit/sec field. If that is also empty, "0" is sent to VMmanager 6, which completely removes the restriction.
- Outgoing traffic limit, Kbps — if empty, value is taken from Outgoing traffic, Kbit/sec field. If that is also empty, "0" is sent to VMmanager 6, which completely removes the restriction.
To manually set or remove restrictions, use commands from the Operations section. These include additional validity checks and protection against data inconsistencies.
Operations
The following operations exist for applying and removing service restrictions:
activate_statlimit
— prepares data and sends a request to VM6 to limit speed. If VM6 responds with a successful speed change confirmation, triggers thepost_activate_statlimit
operation-
post_activate_statlimit
— adds a restriction record to theitem_limitation
table -
deactivate_statlimit
— prepares data and sends a request to VM6 to remove speed restrictions. If VM6 responds with a successful speed change confirmation, triggers thepost_deactivate_statlimit
operation -
post_deactivate_statlimit
— removes the restriction record from theitem_limitation
table
The processingmodule.statlimit.activate
function calls the activate_statlimit
operation.The processingmodule.statlimit.deactivate
function calls the deactivate_statlimit
operation.
Operations automatically retry on failure. Operations with the post_
prefix verify that the restriction or removal was successfully processed by VMmanager 6. After that the item_limitation
database table is modified. To manually execute restriction operations, use these commands:
- to enable restriction:
/usr/local/mgr5/sbin/mgrctl -m billmgr processingmodule.statlimit.activate module=pmvmmgr6 item=123 addon_name=bandwidth
- to disable restriction:
/usr/local/mgr5/sbin/mgrctl -m billmgr processingmodule.statlimit.deactivate module=pmvmmgr6 item=123 addon_name=bandwidth