You may find it inconvenient to have to login to your server every time you want to see your server’s bandwidth statistics. To make it easier to see bandwidth stats one kind soul made a PHP frontend that uses vnStat to obtain the necessary data and display it with pretty graphs.

vnStat php frontend requires that you have apache, php and the php-gd image processing library installed. Installing the latter is as easy as running the following command as root:

VMSTAT is a tool for those people, having dedicated server hosted somewhere remote at IDC/ISP.

vnStat is a console-based network traffic monitor for Linux 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. However, in Linux at least a 2.2 series kernel is required.

* It keeps a log of daily and monthly network traffic for the selected network interface(s).
* It collects all data from /proc file system it means normal user can monitor traffic (no need to run vnstat as a root user)
* Easy to setup & configure
* Ease of use

1. Install vnstat using yum

# yum install vnstat

2. Setup database: Before vnStat can begin logging bandwidth usage you need to tell it to setup the database for your network interface.
Replace eth0 with the correct interface

# vnstat -u -i eth0

Where,

-u :forces a database update for interface or creates the database if it doesn’t exist
-i eth0 : use to specify interface

3. Setup correct interface in config file: By default the vnStat cron job will attempt to collect statistics for the eth0 interface.
If your network interface is different from that one you will have to modifiy the /etc/sysconfig/vnstat file:

# vi /etc/sysconfig/vnstat

—————————————–VNSTAT_OPTIONS=”-i eth3″
—————————————–

4. Setup bash alias: Logout of root now and back to your regular user account. If you intend to use vnstat over the command line and
your network interface is not eth0 you should setup a bash alias for ease of use in your .bashrc file: