linux poison RSS
linux poison Email

Monitor Network data transfer using Vnstat

If you want to monitor and manage your Internet bandwidth, perhaps to make sure your ISP is not overbilling you, try vnStat, an open source, Linux-based application that gives you a clear picture of your bandwidth usage. This utility got the command-line options and also got the UI part which give the output in form of a graph and is simple to install and easy to use.

vnStat is a network traffic monitor for Linux that keeps a log of daily network traffic for the selected interface(s). vnStat isn’t a packet sniffer. The traffic information is analyzed from the /proc filesystem. That way vnStat can be used even without root permissions

Installation/Configuration

1) Download the source - here
2) Untar - # tar -zxvf vnstat-1.6.tar.gz
3) Compile/Install the source

    # ./configure
    # make
    # make install

4) To create a database for vnstat type in vnstat -u -i interface (ie, eth1), after the database is created, which is the first thing to do after a fresh install of vnstat, allow some time for the database to populate with information. After some time just type in vnstat to get a summary of your daily traffic. The database is stored in a file in the /var/lib/vnstat/ directory in a small binary file, you can sets up a cron job that refreshes the bandwidth consumption data on the eth0 port every five minutes

# vnstat


If you're not satisfied with the appearance of vnStat's command-line interface, you can install  PHP-based Web front end for vnStat, which takes the data collected by the command-line vnStat and displays it in tables and graphically in your browser. The front end requires a Web server configured with PHP.

Download the tarball, extract the files into a subdirectory of your Web server's document root directory -- most likely /var/www/ or /var/www/html -- and give it the right permissions so the Web server can write to it:

# mkdir /var/www/vnstat
# tar -zxvf vnstat_php_frontend-1.4.tar.gz -C /var/www/vnstat/
# chown -R www-data.www-data /var/www/vnstat

Launch your browser and visit the vnStat page at http://localhost/vnstat to see something like ...



3 comments:

2O said...

I believe you have a lot to gain by reading this article .

SFSCA said...

Could you help setting up on a Vyatta Router (http://www.vyatta.org). Vyatta already have Lighttpd for its webgui frontend.

Vnstat works great with SSH but I don't want everyone having Vyatta access.

Thank you

Anonymous said...

I installed the vnstat command, but finally it shows [fail] in red color. and i type the command vnstat -u -i eth1. It shows error msg like Unable to read /usr/lib/vnstat/eth1

Post a Comment

Related Posts with Thumbnails