[olug] Bandwidth Metering

Thomas D. Harrison id4spam at cox.net
Wed Jun 14 01:16:26 UTC 2006


A while back I finally choose ipaudit ( but not the web stuff you see  
them pedaling with it ).  It simply logs bandwidth per ip address.   
You can limit your monitoring to specific ports if you want.  Along  
with that, I downloaded the "total" command.

I have ipaudit configured to dump it's results hourly.  I then use  
some cron scripts to accumulate these into daily totals, and weekly  
totals.  I keep 1 week's worth of hourly data and 31 days of daily data.

I've installed it on both ubuntu and debian but I'd bet it works on  
others fairly easily.

Unlike ntop, the system usage is very low.

Thom

On Jun 8, 2006, at 11:39 AM, Charles Bird wrote:

> nope, I'll check into it.
>
>
>> ----- Original Message -----
>> From: "Craig Wolf" <CJWolf at mpsomaha.org>
>> To: olug at olug.org
>> Subject: Re: [olug] Bandwidth Metering
>> Date: Tue, 06 Jun 2006 09:32:27 -0500
>>
>>
>> Have you looked at the bandwidth metering in webmin??
>>
>> Craig Wolf
>> Linux Web Server Support
>> Desktop/Network Specialist
>> 402-894-6283
>>
>>
>>>>> thebirdman at operamail.com 6/5/2006 >>>
>> aha, I was thinking about the same idea as Sam Tetherow has stated,
>> but didnt know how to make it work.
>>
>> But ya, basiclly i would like to have a record of usage for each IP
>> address (currently 16 soon 32)
>> yes route goes thru the "lil linux router that could"
>> and into Proliant hell. :)
>>
>> Thankyou guys for the input.
>>
>>
>>
>>> ----- Original Message -----
>>> From: "Sam Tetherow" <tetherow at shwisp.net>
>>> To: "Omaha Linux User Group" <olug at olug.org>
>>> Subject: Re: [olug] Bandwidth Metering
>>> Date: Mon, 05 Jun 2006 18:28:07 -0500
>>>
>>>
>>> This may not be the most elegant solution, but it's worked for me.
>>> You'll want to rotate the log files every once in a while or date  
>>> them
>>> by setting $IPACCT_DIR to something meaningful like YYYYMM or  
>>> YYYYMMDD.
>>>
>>> Hope it helps.
>>>
>>> For each IP to be monitored:
>>>
>>> iptables -A IPACCT -i $EXT -d IPADDR
>>> iptables -A IPACCT -o $EXT -s IPADDR
>>>
>>> Where EXT is the external interface and IPADDR is the ip address  
>>> to be
>>> monitored
>>>
>>> Every 5 minutes run:
>>> #!/usr/bin/perl
>>> # This is a simple script that runs every 5 minutes and records  
>>> how many
>>> bytes have
>>> # been sent and received foreach IP
>>> # The output is appended to $IPACCT_DIR/$IPADDRESS
>>>
>>> $IPACCT_DIR="/var/log/ipacct";
>>>
>>> open(STREAM, '/sbin/iptables -L IPACCT -n -x -v -Z |');
>>> $ts=time();
>>> while(<STREAM>) {
>>> if
>>> (/^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S 
>>> +)\s*$/) {
>>> # Didn't use all the values, but you might want them.
>>> my ($pkt, $bytes, $proto, $opt, $in, $out, $source, $destination)= 
>>> ($1,
>>> $2, $3, $4, $5, $6, $7, $8);
>>> if ($source eq "0.0.0.0/0") {
>>> $downstream{$destination}=$bytes;
>>> }
>>> if ($destination eq "0.0.0.0/0") {
>>> $upstream{$source}=$bytes;
>>> }
>>> }
>>> }
>>> foreach $ip (keys %downstream) {
>>> # print "$ip\t$ts\t$downstream{$ip}/$upstream{$ip}\n";
>>> open(LOG, ">>$IPACCT_DIR/$ip");
>>> print LOG "$ts\t$downstream{$ip}\t$upstream{$ip}\n";
>>> close(LOG);
>>> }
>>>
>>>
>>> Charles Bird wrote:
>>>> anyone know of a good method of measuring bandwidth usage per
>>> IP > within a given time frame?
>>>>
>>>> Wondering who has done this and if there are recommendations  
>>>> from whomever.
>>>> I am assuming this would be a lil linux router task. I am not >
>>> looking to shape or limit, just monitor usage per IP.
>>>> Thx in advance.
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>>     Sam Tetherow
>>>     Sandhills Wireless
>>>
>>> _______________________________________________
>>> OLUG mailing list
>>> OLUG at olug.org http://lists.olug.org/mailman/listinfo/olug
>>
>>>
>>
>>
>> --
>> _______________________________________________
>> Surf the Web in a faster, safer and easier way:
>> Download Opera 8 at http://www.opera.com
>>
>> Powered by Outblaze
>> _______________________________________________
>> OLUG mailing list
>> OLUG at olug.org
>> http://lists.olug.org/mailman/listinfo/olug
>>
>> _______________________________________________
>> OLUG mailing list
>> OLUG at olug.org
>> http://lists.olug.org/mailman/listinfo/olug
>
>>
>
>
> -- 
> _______________________________________________
> Surf the Web in a faster, safer and easier way:
> Download Opera 8 at http://www.opera.com
>
> Powered by Outblaze
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug




More information about the OLUG mailing list