From owner-freebsd-isp Sat Jun 22 12:16:32 2002 Delivered-To: freebsd-isp@freebsd.org Received: from mailout04.sul.t-online.com (mailout04.sul.t-online.com [194.25.134.18]) by hub.freebsd.org (Postfix) with ESMTP id 7224137B403 for ; Sat, 22 Jun 2002 12:16:12 -0700 (PDT) Received: from fwd07.sul.t-online.de by mailout04.sul.t-online.com with smtp id 17LqMl-0008LH-05; Sat, 22 Jun 2002 21:16:11 +0200 Received: from Turing.picht.org (320017162287-0001@[80.133.175.18]) by fmrl07.sul.t-online.com with esmtp id 17LqMh-0FrszQC; Sat, 22 Jun 2002 21:16:07 +0200 Received: from Turing.picht.org (localhost.picht.org [127.0.0.1]) by Turing.picht.org (8.12.4/8.12.4/Debian-2) with ESMTP id g5MJFMf9001172 for ; Sat, 22 Jun 2002 21:15:22 +0200 Received: (from hans@localhost) by Turing.picht.org (8.12.4/8.12.4/Debian-2) id g5MJFL0u001170 for freebsd-isp@FreeBSD.ORG; Sat, 22 Jun 2002 21:15:21 +0200 Date: Sat, 22 Jun 2002 21:15:21 +0200 From: Hans-Joachim Picht To: freebsd-isp@FreeBSD.ORG Subject: Re: Bandwidth billing and measurement scripts Message-ID: <20020622191521.GA1125@lnxce.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organisation: LNXCE Linux-Consulting-Europe GbR X-Sender: 320017162287-0001@t-dialin.net Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, Jun 19, 2002 at 09:57:04PM +0930, Wincent Colaiuta wrote: > Because I want this thing to be stable, robust, and dependable enough to > use as a reliable platform for billing, a design goal would be to build > it out of simple, well-tested tools that are already present in a > standard FreeBSD install. So we're talking here a collection of Perl and > Bourne shell scripts interacting with ipfw and using dbm and perhaps > 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 > "count" rules - this should give a totally accurate traffic count > without the need to resort to parsing mail, http and ftp logs (which > could get very messy) > - save ipfw output to disc for safe keeping A tool for that is already available. http://www.simon.org.ua/ipa/ > - update usage totals per customer in the dbm database: daily and > monthly totals Daily, weekly and monthly report are not a problem. > - when customer hits bandwidth quota for the month, send a warning email > - when customer exceeds bandwidth quota by 25% or more, account > temporarily suspended (browser redirected to an explanatory page using > mod_rewrite), send customer notification email I develeoped a ugly perl-script to write the ipastat output (link above) into a mysql database. > - generate simple HTML pages showing usage libgd > - provide an easy mechanism for adding/removing hosts/customers to/from > the accounting system > - able to administer from the shell or from a web-interface CGI With best regards Hans -- Work: Consultant with Linux Consulting Europe http://www.lnxce.net Vogelhecke 2 D - 35447 Reiskirchen Tel: +491751629201 Fax: +49640862649 Germany Private: hans@picht.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message