February 23, 2006
Monitoring Bluetooth Data Usage
So I have a Cingular data plan on my phone that lets my Powerbook get internet access from anywhere. Problem is, I'm only allowed 5 mb of data a month before I incur extra charges. Thus, being able to know how many bytes I've used is important. And clearly, I'm not the only one with this issue, so I was *amazed* versiontracker didn't already have an app to do this. Then tonight, when I was on the train (via my phone) I mentioned this issue to Pat, at which point he suggested I look to see if the ppp log in /var/log/ has this data. And he was right - it does! So I whipped up a little unix command line magic to make the log data useful. It looks like this:[DuffyPB867:/var/log] johnh% zgrep Sent ppp.log* | awk '{print $8,$11}' | awk '{ sent += $1; rcv +=$2; tot=sent+rcv;} END { print "bytes sent: " sent; print "bytes received: " rcv; print "Total bytes: " tot;}'
And returns output that looks like this:
bytes sent: 1376042
bytes received: 8413310
Total bytes: 9789352
Now I just need to figure out how to use the date command to make it only look at the last month. That issue is certainly fixable. The only other problem I see isn't so simple - the OSX only writes data use to the log file when you disconnect. This means there is no way I can see to trigger a warning when you are close to but under your limit.
Posted 4 years, 11 months ago on February 23, 2006
The trackback url for this post is http://blog.john-hayes.com/bblog/trackback.php/165/
The trackback url for this post is http://blog.john-hayes.com/bblog/trackback.php/165/
SQL/DB Error -- [Got error 127 from table handler]
Warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/hayes/bblog/inc/bBlog.class.php on line 707
Warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/hayes/bblog/inc/bBlog.class.php on line 715
Warning: Variable passed to each() is not an array or object in /Library/WebServer/Documents/hayes/bblog/inc/bBlog.class.php on line 965
Comments have now been turned off for this post