Friday, March 19, 2010

Vnstat a console based network traffic monitor

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.

The beautiy of Vnstat is that its very simple to install and configure

Installing vnstat on Fedora

Thanks to Fedora folks vnstat can now be installed from Fedora repository using 'yum', please refer to your distro package management commands for installing vnstat on other distros.

yum install vnstat

Monitoring Interface traffic


The commmand forces a database update for interface or creates the database if it doesn’t exist. This is usually the  first  command used after a fresh install.

vnstat  -u  -i Interface

Replace with the Interface name eg, eth0, wlan0 etc

Displaying statistics:

After installation and creating a interface database vnstat can be used from command line to display network traffic statistics

$ vnstat --help

vnStat 1.6 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
         -l,  --live           show transfer rate in real time

5 comments: