vnstat is an excellent and simple tool to monitor your server or interface bandwidth and the results can be displayed both on the server console and on the web interface (with vnStat phpFrontend). Vnstat has the following features included with the new version.

  • Quick installation in less than 2 minutes
    Gathered statistics persists through system reboots
    Multiple Interface monitoring
    Summary, daily, weekly and monthly reports
    Very light and uses only less system resource
    Can install and monitor even without root permission

Installing vnStat

Vnstat can be install either via rpm or from source. Rpm installation is pretty easy, you can download and install it in just one run.

Vnstat rpm
available at :
Select and download the right rpm of your distribution.

  • # wget<your desetro.rpm>
  • # rpm -ivh vnstat-1.7-1.el5.rf.i386.rpm

Once you install, just edit the /etc/vnstat.conf config file and setup the following lines with according to your needs (in my case the network interface is eth0)

  • # default interface
    Interface “eth0”

If you want to store it in a separate database or directory just edit the following lines and change it to your new path/directory.

  • # location of the database directory
  • DatabaseDir “/var/lib/vnstat”

Running vnstat as a deamon

vnStat init script are available at . Just download the corerct os version of your server and copy it inside the /etc/init.d/ . Then enable the daemon by (for centos /rhel / fedora)

  • # chmod 755 /etc/init.d/vnstat
    # chkconfig vnstat on
    # service vnstat start

Installing the vnStat php Frontend.

Download the vnstat php frontend tool directly from . Copy or move the folder to your document-root directory (say for example /var/www/html )

Edit the following lines in the config.php to setup the language and the interface list and title to finish the setup.

  • $language = ‘en’;
  • $iface_list = array(‘eth1’, ‘sixxs’);
  • $iface_title[‘eth1’] = ‘Internal’;
  • $iface_title[‘sixxs’] = ‘SixXS IPv6’;

Try access the vnstat url now to display the stats. It is advisable to setup a password protect directory to avoid unauthorized access. Try my password protect tutorial.

P.S : You can use the same installation/setup instruction to install it in the cpanel , Plesk and Directadmin control panels.

Useful links :

vnStat Cgi-demo

vnStat man page

Screen-caps :

VnStat Summary

Vnstat Daily Graph

Vnstat Monthly Stats