Welcome! Log In Create A New Profile

Advanced

Feature Request: Bandwidth exceeded

Posted by ryan14 
Feature Request: Bandwidth exceeded
September 21, 2009 01:09AM
Nginx should have a feature where the admin can set the maximum incoming/outgoing bandwidth(http/https/ftp, etc) that Nginx can use per month(30 days). The admin can choose what will happen when Nginx reaches the monthly bandwidth limit, like to display a "bandwidth exceeded" page OR an option to automatically shutdown the CentOS/Ubuntu/etc server.
The date/time can be retrieved from the CentOS/Ubuntu/etc clock, so the admin can choose what date/time the month starts at. There should be an option to keep the monthly bandwidth logs on the server.

So for example, if a person chooses a 10000GB(10TB) monthly bandwidth limit, Nginx will either display a 'bandwidth exceeded' html page OR shutdown the server(whatever the admin chooses) when the bandwidth limit is reached.
Re: Feature Request: Bandwidth exceeded
September 21, 2009 10:18AM
That would really not be a webserver function IMO, particularly the part about counting the data transfer of all services. Nginx is not an FTP server so would you want it to parse FTP logs? Nginx can easily limit bandwidth per connection by using limit_rate (with or without limit_rate_after). See http://wiki.nginx.org/NginxHttpCoreModule#limit_rate. But that's not what you want.

What you want is to limit data transfer per unit of time - 30 days in this case. Nginx can log bytes sent using the $bytes_sent variable in the log. See http://wiki.nginx.org/NginxHttpLogModule. Such logs can be kept on a vhost level. You can easily write a Perl script to tally that up but there are many such free ones around that can do that.

The limitation here is that nginx does not, to my knowledge, count bytes received. For most hosting situations that is not a big deal but if there are proxy servers or file uploading services, or even forums that host large uploaded files, then it might be an issue. On the proxies I run, data in is always greater than data out.

The better solution is to use one based one of the many available tools for measuring data transfer and write a script to do the math and suspend accounts when they need to be suspended. Nginx is not a control panel or a hosting panel and won't perform those functions for you.

--
Jim Ohlstein
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 81
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready