Sunday, 25 March 2012

vnStat

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.

 rpm available at : http://packages.sw.be/vnstat/

# rpm -ivh vnstat-1.7-1.el5.rf.i386.rpm

After you install, just edit the /etc/vnstat.conf config file and setup the following lines with according to your needs.

# 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

 Go to http://humdi.net/vnstat/init.d/

Download the corerct os version of your server and copy it inside the /etc/init.d/. Then enable the daemon by

  # 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 http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz. 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′; 

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

Access the gui of vnstat as below
http://192.168.1.67/vnstat

We can get all these information from console itself

Statistics by day:
# vnstat -d

By hour
# vnstat -h

By month
# vnstat -m

Live monitoring of the network interface
# vnstat -l

show top10
# vnstat -t

update database
# vnstat -u

calculate traffic
# vnstat -tr

In the output  Rx and Tx were abbreviation's for Receive and Transmit. Data is crossing or traveling over a cable or through a signal in the air.
 

No comments:

Post a Comment