Mar 172008
 


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.

  8 Responses to “vnStat PHP Frontend – Install & Config Webinterface for vnStat”

  1. 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

  2. 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..

  3. 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.

  4. 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…..!!

  5. Siva, you have to change config.php the option:
    $graph_format=’svg’; change to png.
    Works for me.

  6. Hi!

    Your Frontend works really fine! Thanks a lot for this nice tool!

  7. 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..

  8. It works great.
    Thank you very much.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)