[clue] [tech] Calculate total bandwidth usage for an interface using rrdtool

Charles W Downing chuckdowning at earthlink.net
Fri Jun 10 16:09:10 MDT 2011



On 06/10/2011 02:25 PM, Jim Ockers wrote:
> Charles W Downing wrote:
>>
>>
>> On 06/10/2011 12:06 PM, Jim Ockers wrote:
>>> Hi CLUEbies,
>>>
>>> Well as you know I send an e-mail to this list whenever I'm kind of 
>>> stumped.  I have an OpenWRT based Linux system with a 3G phone 
>>> interface.  Due to the marketecture of 3G data plans, I need to try 
>>> to make sure this device does not exceed its monthly bandwidth 
>>> allotment per our data plan, so we don't get a $60,000 bill, or 
>>> something.  What I was thinking was, since we are allowed 5GB in a 
>>> month, that I would figure out the total bandwidth used in the last 
>>> 3 weeks, and if the total bandwidth was 3/4 * 5GB then I would start 
>>> throttling down the available bandwidth on the interface using tc 
>>> and traffic shaping.
>>>
>>> This seems like it should not be too hard to do.
>> Just an off the wall thought.  Does your provider keep a running 
>> total of your usage during a billing period?  If so, it seems that 
>> you could make a cron job to do the searching, leaving you to script 
>> the local stuff.  BTW, I just checked and Verizon Wireless keeps a 
>> running total of my/our usage to the nearest kB.
>>
> Yes, it's Verizon.  They update their statistics every 24 hours and 
> don't have a convenient API to get the data, which makes it sort of 
> manual.  The stats are not available in real time.  We are looking at 
> nPhase which would overlay their APIs on top of Verizon, and might 
> allow us to automate some of this.  We will probably do that anyway 
> just to make sure we don't ever get a huge phone bill from an overage 
> on one of these - like the guy who watched an NFL game on his cell 
> phone, streamed from his slingbox, on a cruise ship.
>
> Do you have real-time access to the running total of your usage to the 
> nearest kB?  The Verizon people we've talked to act like it takes 24 
> hours to update.
Nope, I just had an idea and went to the Verizon web site with a 
one-time test.  You are obviously way beyond my skill set.
>
> Even so there is a difficult inventory control challenge to make sure 
> that system XXXXX, which might have 3G modem YYYYY, gets the memo from 
> central-command that it should start throttling back its network 
> usage.  I'm trying to avoid saving the state on a central server 
> because it'll use bandwidth which a) costs money and b) puts us closer 
> to the bandwidth cap.  Some telemetry is necessary so if this turns 
> out to be unavoidable then that's what I'd do.
>
> It would be nice if the 3G modems would do this for us on their own, 
> but they don't.
>
> I like Dan Kulinski's idea of using iptables with "iptables-save -c" 
> to save the state and counters, and it looks like that would make the 
> data persist across a reboot.
>
> Thanks,
> Jim
> -- 
> Jim Ockers, P.Eng. (ockers at ockers.net)
> Contact info:http://www.ockers.net/msi.html
>
>
> _______________________________________________
> clue mailing list: clue at cluedenver.org
> For information, account preferences, or to unsubscribe see:
> http://cluedenver.org/mailman/listinfo/clue

-- 
Chuck Downing
Highlands Ranch, Colorado USA

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20110610/5fc907c9/attachment.html 


More information about the clue mailing list