Naveen Kumar (नवीन कुमार) (moebiuscurve) wrote,
Naveen Kumar (नवीन कुमार)
moebiuscurve

How I keep track of my bandwidth usage...

Since my current Internet Service Provider Reliance Communication has started cheating, I now keep an account of my bandwidth usage. Here's a script I use for every internet session:

-----------------------------------------------------------------------------------------
filename: netusage.sh
-----------------------------------------------------------------------------------------
#!/bin/sh

while(2>1)
do
date >>usage.txt
ifconfig ppp0|tail -n 2 >>usage.txt
ifconfig ppp0
if [ "$?" -ne "0" ]; then
cp usage.txt $( date | sed -e "s/://g" |sed -e "s/ //g").txt
rm usage.txt
break;
fi
sleep 180;
done
-----------------------------------------------------------------------------------------
It takes a sample of usage every 3 minutes and when you are done, dumps your usage for the session in some file with name such as "SunFeb5044143IST2012.txt". Later you can grep, cut and sum all of your usage from all of the files for a particular period.

And if you are interested in some graph of your usage pattern, you cane even do that using some kind of regression or time series.

Other better ways are welcome.
Subscribe

  • An odyssey with toys

    A day before yesterday I made a visit to a toy manufacturing company in Pune to gain some new perspective on the book I am currently writing. The…

  • A small review of some math apps on Android

    Among the math apps, I can say MathStudio (very costly, but worth spending if you know how to use it) and MyScriptCalulator (No cost) are the best…

  • An ode to flattery...

    Our Lord's ears are great & it must be worshipped. There is but one truth, to worship his ears. The grooves, curves and the twists in his ears…

  • Post a new comment

    Error

    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments