Server Administration & Management

How to monitor bandwidth usage with vnStat PHP based web frontend

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:

1. Install Apache Web server, php and php-gd

# yum install httpd

# yum install php

# yum install php-gd

2. Download vnStat PHP for Installation

# wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz

# tar -xzf vnstat_php_frontend-1.4.1.tar.gz

3. place it in a web accessible place like /var/www/html

# mkdir /var/www/html/vnstat

# mv vnstat_php_frontend/* /var/www/html/vnstat

4. Edit the config.php file: Just set the correct binary name:

# vi /var/www/html/vnstat/config.php

$vnstat_bin = ‘vnstat’;

October 16, 2011 Posted by | PHP, Tips & Tricks, Unix/Linux | , , , , | Leave a comment