Web Hosting Talk







View Full Version : Limiting bandwidth?


DelusionalMi
02-09-2002, 11:01 PM
Is there any way that you can limit bandwidth on a specific user on the raq4?

i know you can limit the diskspace and the kbps, but is there any way to limit the bandwidth (so that they can have like 3 gigs of bandwidth or whatever per month)?

Chicken
02-09-2002, 11:14 PM
either mod_throttle or mod_bandwidth (search for info on these on the forum or on the web)

DelusionalMi
02-09-2002, 11:27 PM
thanks :)

Omair Haroon
02-10-2002, 04:47 AM
DelusionMi,

Would you like to share how were you able to install mod_throttle on your server?


Salam,
-Omair

GideonX
02-10-2002, 08:54 AM
installing mod_throttle is a piece of cake on a raq. here are steps that i used which i know work (done it twice now)

wget http://www.snert.com/Software/mod_throttle/mod_throttle312.tgz

tar -xvfz mod_throttle312.tgz

go into the Makefile and edit the line that says APXS=apxs (or something like that) and change it to: APXS=/usr/sbin/apxs

if you don't do that, most of the time when u do make, it'll come up with an error saying it can't find it. anyway...

make
make install

open up your httpd.conf and add this:

<IfModule mod_throttle.c>
ThrottlePolicy none

<Location /throttle-status>
SetHandler throttle-status
</Location>

<Location /throttle-me>
SetHandler throttle-me
</Location>

<Location /~*/throttle-me>
SetHandler throttle-me
</Location>
</IfModule>

this should be in the same area where it says Extra Modules. If the make install went through correctly, you should already have

LoadModule throttle_module /usr/lib/apache/mod_throttle.so
AddModule mod_throttle.c

listed there. now scroll down a bit to your virtual sites and add these lines (there are more options, but this is the most basic i think) right underneath RewriteOptions inherit:

<IfModule mod_throttle.c>
ThrottlePolicy Volume 20G 30d
</IfModule>
<Location /throttle-me>
SetHandler throttle-me
</Location>

this will limit that one site to 20GB in 30days. you may also wish to add this:

<Location /throttle-status>
SetHandler throttle-status
AuthType Basic
AuthName Throttle
AuthPAM_Enabled on
require user USERNAME_HERE
</Location>

to your main site. this will allow you to view all sites that you are throttling by going to http://www.domain.com/throttle-status. I threw in a really basic password protection in there too. so only the username you specify is allowed to view that page.

restart apache and you're set. hope that helps...

Omair Haroon
02-10-2002, 10:28 AM
Thanks GideOnX,

I was already able to install mod-throttle on the server with the help of a friend.

Though, thanks for the concern and your time.


Salam,
-Omair

GideonX
02-10-2002, 12:56 PM
not a problem :) im sure someone else is going to ask the same question and run into the same problem i did. might as well throw it out there for 'em.

blacknight
08-08-2002, 06:07 AM
Excellent instructions - thanks!
The only small gotcha might be the location of mod_throttle.so
The 'make install' seems to point to a non-existent directory, so you might need to edit the line slightly to point to the Apache modules directory, which is:
/usr/lib/apache NOT /lib/apache as the make install suggests

hostchamp
09-05-2002, 03:11 PM
Awesome
Worked Great
Out of the BOX

GiedonX this worked on fine

I got one error though;
Starting httpd: Syntax error on line 3758 of /etc/httpd/conf/httpd.conf:
Invalid command 'AuthPAM_Enabled', perhaps mis-spelled or defined by a module not included in the server configuration

I commented the AuthPAM line and it worked without the user authentication, any idea how i cna get this to work as well?
Do i have to define the module somewhere?

hostchamp
09-05-2002, 04:29 PM
GiedonX where can i get a complete documentation on the syntaxes / options which can be used with mod_throrrtle.

Any idea what would the syntax be if i want to set 500mb / 30d?

blacknight
09-05-2002, 04:37 PM
There's a lot of information on the official site:
http://www.snert.com/Software/mod_throttle/

hostchamp
09-05-2002, 05:13 PM
blacknight i have throttled about 5 sites, now all sites can see the mod_throttle page aa www.domain.com/throttle-status as opposed to above, i would want only one site to show the throttle-status and not the customer site to show throttle-status, at best it could show throttle-me so that a customer can view its own data

GideonX
09-09-2002, 09:22 AM
Originally posted by hostchamp
blacknight i have throttled about 5 sites, now all sites can see the mod_throttle page aa www.domain.com/throttle-status as opposed to above, i would want only one site to show the throttle-status and not the customer site to show throttle-status, at best it could show throttle-me so that a customer can view its own data

what i do is set a password for throttle-status. but you do need to get AuthPAM working.

hostchamp
09-09-2002, 03:43 PM
yes, i got this working too, also the throttle-status page is showing on only the virtualhost i want to, i commented out the global directive for throttle-status which was causing this to open across all sites.

Also i did not use AuthPAM, but instead i am using .htpasswd protection, it works great. Thanks for all ya posts.

Cheers!

realalien
10-25-2002, 08:46 AM
hello :)

could you please tell me how you did to add a .htaccess/.htpasswd statement for the /throttle-status?

I know how httaccess and htpasswd works... but I have no clue how to do it with aliases like /throttle-status/ and /throttle-me/

thanks for your help!

hostchamp
10-26-2002, 03:14 PM
sure realalien i will msg this to you tomorrow, i am off to some work now and will login to my server and paste the block i used to create the .htpasswd protection, its cool!

realalien
10-27-2002, 04:42 AM
thanks indeed hostchamp! waiting for your pm or post.

cheers!

hostchamp
10-28-2002, 05:42 AM
Okay here you go.

first comment the following lines in your httpd.conf unlike as described in the tutorial else it will cause your throttle-status page to open across all domains.

#<Location /throttle-status>
#SetHandler throttle-status
#</Location>

thereafter include the following inside the virtualhost block where you would want your throttle-status page to open;

<Location /throttle-status>
SetHandler throttle-status
AuthUserFile /path/to/.htpasswd
AuthType Basic
AuthName "Throttle"
require valid-user
</Location>

You need to generate the .htpasswd, that's it. Your domain will now pop up the htaccess passwd window before u can access the status page.

Cheers,
Viv

realalien
10-28-2002, 09:59 AM
thanks a lot! going to insert the code within today. does this system also work for /throttle-me ?

cheers!!

hostchamp
10-28-2002, 10:26 AM
yes, this is just a basid htpasswd protection i threw in there, u can put in anywhere you want to, will restrict throttle-me access as well if u threw it in there.

cbtrussell
10-28-2002, 11:56 AM
Have any of you run into a problem where the status page rounds the throttle period off? I had one install recently where the period was set to 30 days, yet the status page shows 4w. 31=4w, 35=5w, and so forth. Very weird. Other boxes (all RaQ4's) worked flawlessly. Not sure if the actual throttling application is working on 30d or 4w, no way to really know other than wait.

Brandon

hostchamp
10-29-2002, 04:11 AM
i threw 30d too, but the status page rounds this off to 4w, i assume it rounds off.

cbtrussell
10-29-2002, 09:51 AM
I have done several installs that show 30d, just like it's supposed to. That's the only reason I know this isn't normal...

B

hostchamp
11-07-2002, 09:44 AM
pls let me know if u find out how the status page would show 30d ?

atrocity
11-19-2002, 07:03 PM
Hi,

Do you think that it can be possible to make that mod_throttle send a email if a site is on the throttle limit ?
I try to search on my places, and don't find that ;(
It can really be interesting to receive a email, because i don't want to take every day a look in the status pages...
Let me know
jeanjean@gmx.net

hostchamp
11-20-2002, 01:31 PM
i think it would require some customization, it could pick the email address from the "server admin" tag defined inside the virtuahost block, even if the email is send to the root, we will know and can notify customer accordingly. May be we can get some apache experts to talk here.

Serevinus
12-24-2002, 12:29 PM
I would like to be able to set a soft limit if thats possible

What I would like to be able to do is specify say 2gigs transfer per month, but allow the user to go over that limit and just send them an email telling them they have gone over their limit and will be charged extra on the next billing cycle

Any ideas?

blind9
10-09-2004, 12:26 AM
I tried doing this, but when I restart apache I get this error:

Starting httpd: Syntax error on line 219 of /etc/httpd/conf/httpd.conf:
Cannot load /etc/httpd/modules/mod_throttle.so into server: /etc/httpd/modules/mod_throttle.so: undefined symbol: ap_user_id
[FAILED]


Does anyone know why im getting that error? I can't find the answer anywhere...

thanks

Blueheaven
11-06-2004, 07:46 PM
I want to limit the speed for users on a virtual host.
i.e 56kb per user
but It doesnt seem to work for me
ThrottleClientIP size policy limit period

ThrottleClientIP 1000 Speed 56K 1s
but iI type that in I get an error upon restarting


~]# /etc/rc.d/init.d/httpd restart
/etc/rc.d/init.d/httpd: line 202: 13366 Segmentation fault (core dumped) $HTTPD -t >/dev/null 2>&1
/etc/rc.d/init.d/httpd restart: configuration broken, ignoring restart
/etc/rc.d/init.d/httpd restart: (run 'apachectl configtest' for details)

If I try ThrottlePolicy Speed 56K 1s
It works but that means only one user can download 56k at the one time.

Any solutions