As I have 20 GB of data per 30 day period or an average of 682 MB/day of data to use with my hotspot device I use at home for Internet during the winter months for work and play, I have to be careful on how much data I use

As I have 20 GB of data per 30 day period or an average of 682 MB/day of data to use with my hotspot device I use at home for Internet during the winter months for work and play, I have to be careful on how much data I use. While I only used about 11 GB during the December 24 – January 23 period, it’s important that I be measured with my data use.

I wrote a short script to output my connection strength, 5-minute / 1 hour / 1 day data use and current topΒ  application using data that I display in the XFCE panel using gen-monitor. For example, this is the display:

LDL314DL_7014: 70/-22
4.29 KB / 72.50 KB / 118.28 MB
/usr/lib/firefox/firefox/

Here is the PHP script I use to generate it — it’s a mix of PHP and BASH. I could have done it all in BASHΒ  but truth be known I’m lazy and I’m better at PHP coding.

$net = exec("iwlist scan 2>/dev/null | egrep -i 'Signal level='|cut -b 29-31,49-51|sed -n '1p'");

$ssid = exec("iwgetid wlo1 -r");

$dataTtl = str_replace('i','',preg_replace('/^( *)/', '',exec("vnstat | sed -n '19p'|cut -d\| -f 3")));

$dataHr = preg_replace('/^( *)/', '', exec("vnstat -h | tac | sed -n '2p' | cut -d\: -f 1"));
$dataHrAmt = str_replace('i','',preg_replace('/^( *)/', '', exec("vnstat -h | tac | sed -n '2p' | cut -d\| -f 3")));

$dataMinAmt = str_replace('i','',preg_replace('/^( *)/', '', exec("vnstat -5 | tac | sed -n '2p' | cut -d\| -f 3")));

$nethogs = preg_replace('/(\d.*)$/', '', exec("nethogs -t -c2 2>/dev/null|tac|sed -n '2p'"));

if ($ssid != '') echo "$ssid: $net\n";
else echo "Offline\n";
echo "$dataMinAmt / $dataHrAmt / $dataTtl\n";
echo "$nethogs";

I actually enjoy watching the meter and being careful with my usage. It forces me to be deliberate, and make sure I’m careful with the data I’m consuming, using my smartphone for video meetings and watching video. I am actually surprised how little data ordinary web surfing uses – it’s really the video and downloads that eats a lot of data – especially the big GIS files. But I can go to the library for such purposes.

While I don’t have a good count based on SSID, it looks like I used about 11.2 GB on the hotspot and 19.2 GB on wired networks, mostly at the library and some at my parents house, downloading videos for later watching, updating or installing Linux apps, and downloading large GIS files. Downloading Youtube videos for later consumption really is a big bandwidth suck.

I like the challenging of being aware of my internet consumption and being responsible about the amount of data I use each day.

Leave a Reply

Your email address will not be published. Required fields are marked *