Bandwidth Monitor (vnstat)


2 posts
by Ogoshi » Sun Jun 03, 2012 4:14 pm
I've found vnstat to be useful for monitoring bandwidth on Raspbmc (although it would work fine on Debian squeeze too)

Link here - http://www.debian-administration.org/articles/330

To install type - sudo apt-get install vnstat

Then to start it type - sudo vnstat -u -i eth0

I found that it wasn't updating the database automatically (i guess this may be a permission issue, beyond my beginner linux knowledge!) to get round this, when you want to view the stats type - sudo vnstat --update
Then just type - vnstat
to view.

You can also do vnstat --live to well erm see the activity live...

There are a variety of commands in the help page too.

Apologies if any of that is incorrect or useless, I'm a linux beginner and typing on my phone - typos highly likely!
I found this quite useful while live streaming with tvcatchup

Note: this will count all traffic to/from the pi regardless of wan/lan!

Gary
Posts: 44
Joined: Wed Dec 28, 2011 5:13 pm
Location: Southend-on-Sea, Essex, England
by linorics » Sun Jun 24, 2012 7:42 pm
Thanks for the tool I'll have to check it out.

One thing to note is that Linux keeps track of this in a file as well.

Code: Select all
cat /proc/net/dev


This will return the counter of all of the traffic passing through off of the interfaces.
Code: Select all
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:     560       8    0    0    0     0          0         0      560       8    0    0    0     0       0          0
  eth0: 36911726  587879    0    0    0     0          0         0  1043482   10340    0    0    0     0       0          0


It makes for a fun coding project to extract the right field and the the bandwidth.
Posts: 8
Joined: Sun Feb 12, 2012 3:10 pm