Date: Wed, 19 Jun 2002 21:57:04 +0930 From: Wincent Colaiuta <wincentcolaiuta@mac.com> To: freebsd-isp@FreeBSD.ORG Subject: Re: Bandwidth billing and measurement scripts Message-ID: <DD446E42-837F-11D6-A68D-003065C60B4C@mac.com> In-Reply-To: <MBEKKDFNOOOCNGBGIOMHEEKCGFAA.bambi@Hughes.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
El Wednesday, 19 June, 2002, a las 03:10 PM, David J. Hughes escribi=F3: > If you really need to do this for true volume numbers (rather than = just=20 > the > info you can glean from the log files) you could run a proxy in front = of > your web server(s) (i.e. a reverse proxy, or distributor, or whatever=20= > your > terminology dictates) and assign each virtual host a distinct private = IP > address. In effect you allow the proxy box to act as an HTTP 1.1 to=20= > HTTP > 1.0 gateway. Do your traffic accounting based on the private IP's=20 > (using > ipfw on the proxy box or whatever method you choose) and your problem = is > solved. I'm not saying I'd do it but it would give you what you are=20 > looking > for (i.e. real IP accounting on 1.1 virtual hosts). Thankyou David (and others on this list) for the helpful responses. So=20= far no one has given me exactly what I was after, and after a thorough=20= search of freshmeat.net it is looking as though I will end up coding=20 this thing myself. Because I want this thing to be stable, robust, and dependable enough to=20= use as a reliable platform for billing, a design goal would be to build=20= it out of simple, well-tested tools that are already present in a=20 standard FreeBSD install. So we're talking here a collection of Perl and=20= Bourne shell scripts interacting with ipfw and using dbm and perhaps=20 some flat files for data storage, all driven by cron. What I'd like it to do: - run as an hourly cron job - count incoming and outgoing bandwidth user per IP based on ipfw=20 "count" rules - this should give a totally accurate traffic count=20 without the need to resort to parsing mail, http and ftp logs (which=20 could get very messy) - measure % of traffic accounted for http, ftp, mail and "other" (an=20 interesting statistic, but not really a useful one, seeing as in the end=20= the customer has to pay for it all anyway) - save ipfw output to disc for safe keeping - update usage totals per customer in the dbm database: daily and=20 monthly totals - when customer hits bandwidth quota for the month, send a warning email - when customer exceeds bandwidth quota by 25% or more, account=20 temporarily suspended (browser redirected to an explanatory page using=20= mod_rewrite), send customer notification email - generate simple HTML pages showing usage - provide an easy mechanism for adding/removing hosts/customers to/from=20= the accounting system - able to administer from the shell or from a web-interface We choose to implement these last couple of somewhat draconian measures=20= because here in Australia bandwidth is not cheap (about 20c/meg,=20 incoming). We want to avoid any ugly situations where a customer manages=20= to get slashdotted (or whatever) and finds themself with a horrid=20 bandwidth bill (remember, here in Australia, bandwidth will cost them=20 about $200/gig thanks to our monopoly telecommunications supplier,=20 Telstra). We figure it's better to temporarily suspend the off account=20= here and there than to have customers running up large bills that they=20= later refuse to pay (or whatever). If they are pushing out so much data=20= that they exceed their quote then they should be on a higher-volume=20 plan, or host their site in the US... In any case, any further suggestions appreciated, but will send to the=20= list a link to whatever I end up devising. Cheers Wincent To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DD446E42-837F-11D6-A68D-003065C60B4C>