vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won’t actually be sniffing any traffic and also ensures light use of system resources.
Step 1. Installation:
apt-get install vnstat
Step 2. Select the interface you wish to monitor:
for eth0 :
vnstat -u -i eth0
Repeat this changing eth0 for each interface you wish to monitor.
NOTE: Once the text database have been initialised you’re ready to monitor your bandwidth usage. The package installs a cronjob which will update the database every five minutes.
The most simple way of doing so is to just invoke the command with no arguments:
vnstat
The output will be something like this:
$ vnstat
Database updated: Sat Jun 19 23:50:01 2010
eth1 since 1/17/10
rx: 3.32 TiB tx: 2.81 TiB total: 6.13 TiB
monthly
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
Jul '09 609.40 GiB | 282.21 GiB | 891.61 GiB | 2.79 Mbit/s
Aug '09 16.95 GiB | 10.46 GiB | 27.40 GiB | 2.80 Mbit/s
------------------------+-------------+-------------+---------------
estimated 552.14 GiB | 340.70 GiB | 892.83 GiB |
daily
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
yesterday 19.19 GiB | 8.63 GiB | 27.82 GiB | 2.70 Mbit/s
today 16.95 GiB | 10.46 GiB | 27.40 GiB | 2.80 Mbit/s
------------------------+-------------+-------------+---------------
estimated 17.81 GiB | 10.99 GiB | 28.80 GiB |
U can use vnstat –help for more options and info:
$ vnstat --help
vnStat 1.10 by Teemu Toivola
-q, --query query database
-h, --hours show hours
-d, --days show days
-m, --months show months
-w, --weeks show weeks
-t, --top10 show top10
-s, --short use short output
-u, --update update database
-i, --iface select interface (default: eth0)
-?, --help short help
-v, --version show version
-tr, --traffic calculate traffic
-ru, --rateunit swap configured rate unit
-l, --live show transfer rate in real time
See also "--longhelp" for complete options list and "man vnstat".
Done.

Recent Comments