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!