B. Dijkstra at SQWEEK.com has written a simple PHP web frontend for vnStat. The latest stable version is 1.4.1 and is available for download here
vnStat PHP Frontend requires
Apache Webserver (use Apache2.2.3 here)
PHP (use PHP5.2.0-8)
GD Image librariesvnStat already installed
So lets get the prerequisites install.
Install PHP5
DebianSystem# aptitude install php5
Install GD Image Libraries
DebianSystem# aptitude install php5-gd
Install Apache2 Webserver
DebianSystem# aptitude install apache2
Now, the pre-requisites are installed. You need to have a functional vnStat running on the system. For install instructions click here
Download vnStat PHP Frontend
Download the vnStat PHP Frontend from here
DebianSystem# wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz
Unzip & Untar the files
DebianSystem# tar -zxvf vnstat_php_frontend-1.4.1.tar.gz
Move the files to Apache Webserver Root
DebianSystem# mv vnstat_php_frontend-1.4.1 /var/www/vnstat
Edit Config file for the Interfaces
DebianSystem# vi config.php
Look for
$iface_list = array(‘eth0’);
and
$iface_title[‘eth0’] = ‘Internal’;
//$iface_title[‘eth1’] = ‘Internet’;
//$iface_title[‘sixxs’] = ‘SixXS IPv6’;
and alter it to your systems requirement acfordingly (say change name of interfaces or add multiple interfaces)
Example
$iface_list = array(‘eth0’ , ‘eth1’);
Now, that all is done, simply access the site and you can see the vnStat stats with graphs that you would otherwise see only in console.
I’m did everything on this site. vnstat is working perfectly on the console. But, when I tried the frontend. No data avaible is display on the screen. What am I doing wrong?
John
You got to make sure you set path to your vnstat binary, as well path to vnstat interface dump..
/usr/bin/vnstat
/var/lib/vnstat/vnstat_dump_eth0 for example
read the info in your config.php file…
It works fine for me..
Author of this post should change the link pointing to version 1.3 and put 1.4.1 as this release fixes bugs and issues found in earlier versions.
Hi,
I could see the vnstat data through vnstat_frontend but not the images. Could you please aid me in this to view the image in vnstat_frontend…
Thanks in advance…..!!
Siva, you have to change config.php the option:
$graph_format=’svg’; change to png.
Works for me.
Hi!
Your Frontend works really fine! Thanks a lot for this nice tool!
Works good for me, my Internet plan has free download from 2am to 8am and remaining time limited usage of 1GB / month. I tried changing the source code to suit my preference so not to include data transfer during 2am to 8am, but failed. could anyone help me sorting out the issue pl..
It works great.
Thank you very much.