|
| Top | Log In | Cart Contents | Checkout |
ET/BWMGR Bandwidth Controls (aka Quotas)The ET/BWMGR HTML interface includes a module for setting up "controls" that allow you to apply different bandwidth management profiles depending on whether the total bandwidth used by a client is under or over its monthly allotment. This sort of control is valuable to ISPs who sell tiered services with monthly bandwidth allotments. The controls provide an automated mechanism for implementing enforcement policies when such quotas are reached. To enable the Controls screens, you need to enable the setting in your Defaults settings. Setting up Controls to Run on Your SystemBy default, controls are disabled. Controls run as a php script, and should be run from cron: 1 * * * * root /usr/local/sbin/bwmgr_controls.php Uncomment this line in /etc/crontab to enable running the controls once an hour. You can run them more often if you like, or less often as well. To run controls every 10 minutes: */10 * * * * root /usr/local/sbin/bwmgr_controls.php By default, controls check for a reset condition between 12:00AM and 12:05AM, where a reset is defined as checking to see if a daily or monthy control needs to be reset to its initial profile. Daily controls need to be reset every day, while monthly only at the beginning of a month. This implies that you must run the script at 12:00AM to 12:04AM in order for this to hit. You can also force a reset at any time by running the program with the reset parameter: 1 0 * * * root /usr/local/sbin/bwmgr_controls.php reset The above setting would run controls with a reset at 12:01AM. To use controls, you'll also need to set a password for your bwmgr command line so the script can run commands without being superuser. The default password is saturn5. To use the default password: bwmgr setpwd saturn5 To set the password to something else, use the above command as well, and also edit /usr/local/sbin/bwmgr_controls.php: $bwmgr_pwd="your_password" Viewing the Controls ScreenTo see the controls screen, select the "Controls" link at the top menu of the bandwidth management You will see a screen similar to the following:
If you get a message saying "Can't Access Controls", you should check to make sure that you have successfully created to required database table, bwmgr_controls. "mysqldump etbwmgr bwmgr_controls" should show the table in its listing. The first column pull-down menu contains the rules you have created in your system that have names assigned to them. All controls are done by name, which allows you to apply controls on any interface in the machine. Rule Names must be unique, so there can be no conflicts. If you activate the pulldown in this column, the first value will be "default", and then you will see all of the rules with statistics enabled in your system in alphabetical order. Select the name for which you want to create a control (we'll discuss the default rule later). Then enter the monthly allotment of bandwidth in megabytes. The next 2 colums are the "under" and "over" bandwidth profiles. When the total bandwidth used is over the Monthly Bandwidth specified, the under profile will be used for this rule. When the rule is over the allotment, the over profile will be used. The pulldown menus will have a listing of the profiles that you have defined for the system. You MUST use profiles to use bandwidth controls, so if you have none defined then you will have to do so before adding controls. The last column allows you to specify whether you want a notification email to be sent when the rule goes over its control. Adding a ControlTo add the control after selecting the setting, press the Add Control button.
The control will be displayed in the bottom table with the settings selected. The Rule Name is a link that allows you to edit the control, and the control entry menu above is blanked out, ready to add a new control. Note that in the control we added that the "under" profile is "no limit". While you can leave the profile blank, the profile will not be reset properly to the "under" profile at the beginning of the next month. Leaving the profile blank indicates "no action", so this is not really what you want. You should create a profile with no bandwidth limits (if that is a setting that you use) for the controls to work properly. NotificationYou can optionally enable email notification within the control, which indicates than an email should be sent when the specified bandwidth usage is reached. The notification will only be sent once.
The notify list can contain more than one address, separated by commas, however more than 2 will likely not fit. If you need to send to more than 2 recipients, you can create an alias for the list in /etc/aliases. If you have specified an address in your Defaults section the email will be sent with that address as the source address, and a BCC: will be sent to that address also. If you select "Use Standard Message", the first line of the email will tell them which limit they exceeded (Daily or Monthly) and also what the total allowance is. Note that in order to use notification you will have to have sendmail (or some other mailer) running on your system. To run sendmail you'll need to give the machine a real hostname and set up DNS. In FreeBSD you'll need to enable sendmail in rc.conf. in your startup tasks. Applying Bandwidth ProfilesBandwidth controls are administered by the bwmgrd daemon. Every 2 hours the controls are checked to see if any are over their bandwidth allotment. If so, the "over" bandwidth profile is applied. Whenever the over profile is applied, the record it checked to see of notification has already been sent for the current month. If notification is enabled and none has been sent yet this month, an email will be sent. Note that the "under" profile is applied in only 2 instances. Whenever bwmgrd is started, each control is checked that its rule has the correct profile. If not, either the under or over profile will be applied. Also, at the beginning of each month, all controls will have the under profile applied. The "Default" ControlThere is a "default" control that can optionally be used. Note that the existence of this keyword implies that you should not have a real rule named "default". When the "default" controls exists, any non-statsonly rule with stats gathering enabled that does not have a specific control associated with it will use the default control. This can be convenient if you have a standard product, say 20GB per month, that most of your customers are assigned. In this case, you only need to define specific controls to customers that have some other service. Be aware that the used of default will obviate the need to assign controls to everyone. If you use default, and you have customers that have no limits, then you will have to create controls with "no control". Setting a "No Control" ControlIf you have a "Default" profile, you may need to set up a control with no controls for customers that do not have any controls. You cannot have a control with a setting of 0 MB/month, so you can set the limit to any number. Since you really dont want anything done, you should set it to a number that is not likely attainable. Then you can either assign no profile or a "no limit" profile to the customer.
The above settings assign AcmeWidget and NoLimitCust controls other than the default. Any other rules defined will use the default enforcement. NoLimit has the same profile for under and over (and notification disabled), so there is no effect even if there were to reach the specified limit. Its simply a way to keep the default from acting on the rule |