I’ve been on a major self improvement kick lately. I’ve kicked several crazy habits including, but not limited to:
- Smoking
- Biting my nails
- Soda
- Sugar (practicing moderation)
Next on my self improvement quest, I decided to start monitoring bandwidth usage and tracking it on my blog so I(and you!) can follow how much I’m using, and try to trim it down to a reasonable level. I’m not going to play around, I am seriously addicted to the internet. It is one of my oldest, hardest to moderate addictions EVER. I figured if I kept track of how much I actually use on a daily basis that it would help me moderate myself.
So, this morning I downloaded and installed vnstat and initialized the database for my single interface like so:
sudo vnstat -u -i eth0
Where eth0 is the interface all my network traffic routes through. To track multiple interfaces, run the above command again, swapping out eth0 for the other interface.
Next I fired up the following cron:
*/5 * * * * if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi
It samples usage on any interface you specify every 5 minutes and creates awesome statistics from it. So, whenever I have a quick break between tasks, I run vnstat and get a glimpse at my usage.
Now, this is the part that scared me a bit.. I never really thought about how much I use. I fired all of this up at ~9:00AM, the snapshot below was taken at 10:45AM.
bsmith@bsmith-desktop [10:47:06 (0.17)] ~
-> vnstat
Database updated: Tue Jan 26 10:45:01 2010
eth0
received: 40.68 MB (81.6%)
transmitted: 9.89 MB (18.4%)
total: 50.57 MB
rx | tx | total
-----------------------+------------+-----------
today 40.68 MB | 9.89 MB | 50.57 MB
-----------------------+------------+-----------
estimated 89 MB | 20 MB | 109 MB
I, um, yeah I use the internet, a lot..
There are lots of other fun things you can do with vnstat, but I’ll mainly just look at incremental snapshots, and the money shot: daily usage.
Daily output looks like this:
bsmith@bsmith-desktop [10:47:41 (0.09)] ~
-> vnstat -d
eth0 / daily
day rx | tx | total
------------------------+-------------+----------------------------------------
26.01. 42.19 MB | 10.35 MB | 52.53 MB %%%%%%%%%%%%%%%%%%%%:::::
------------------------+-------------+----------------------------------------
estimated 92 MB | 22 MB | 114 MB
As said previously, I’m going to post my bandwidth usage daily, either here, or on my Posterous for the next month. I don’t really have a goal here, just want to be able to trim my usage to hopefully stave off some of my internet “dependency” issues..
Stay Tuned!
Comments
I’d like to see it broken down by protocol. Stuff over HTTP is probably more of a waste of time than stuff over SSH, for me anyway.
Good luck with the project! Seems fun.
I could probably use the sysstat tools (sar) to accomplish that. You can get pretty detailed.
One thing I forgot to mention is that I also removed all the social networking apps from my phone. Thinking that will help a lot.
I don’t see that this is that bad! A simple video, large software package, etc. download would show that kind of usage.
Maybe the tracking should be at the browser level. Tracking access to time wasting websites (facebook, twitter, fmylife). Or at the protocol level as previously suggested for WoW servers or chat protocols…
Yea, I’m going to have to take another approach. As was mentioned by @garybernhardt, I shouldn’t penalize myself in the case of a large download, etc.
This is VPS or real server?
Comment form for «Tracking personal bandwidth usage.»