Skip to Content

archive

Daily Archives: May 1, 2013

post

Failing at Life

screenshot_065

post

vnStat and vnstat PHP Frontend Installation – CentOS

Yum installation

yum install vnstat

Edit configuration

vim /etc/sysconfig/vnstat

I only have one interface (eth0), you may have more (eth1 etc…)

# see also: vnstat(1)
#
# starting with vnstat-1.6 vnstat can also be
# configured via /etc/vnstat.conf
#
# the following sets vnstat up to monitor eth0
VNSTAT_OPTIONS="-u -i eth0"

Edit configuration

vim /etc/vnstat.conf

Set your default interface

# default interface
Interface "eth0"

Setup your database

vnstat -u -i eth0

Start vnStat service

chkconfig vnstat on

Other commands for vnStat

service vnstat start
service vnstat stop
service vnstat restart
service vnstat status

Check if installation has been successful

vnstat
vnstat -i eth0

Run –help for more commands

vnstat --help

Now install php front end.
Install these if not already installed

yum install httpd php php-gd

Go to the directory you want to install the frontend. i.e. www.domain.com/vnstat/

# make directory
mkdir /home/domain/public_html/vnstat
# change to directory
cd /home/domain/public_html/vnstat
# download frontend files
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz
# untar file
tar xvf vnstat_php_frontend-1.5.1.tar.gz
# delete tar file
rm -f vnstat_php_frontend-1.5.1.tar.gz

Configure vnStat php frontend

vim /home/domain/public_html/vnstat/config.php

Look for the following Strings and edit them

$language = 'en';
$iface_list = array('eth0');
$iface_title['eth0'] = 'Internal';

Check if frontend has been installed correctly
www.domain.com/vnstat/

If you get the following error:

This page contains the following errors:

error on line 10 at column 10: error parsing attribute name
Below is a rendering of the page up to the first error.

Edit your config.php file

vim /home/domain/public_html/vnstat/config.php

Look for

// graphics format to use: svg or png
$graph_format='svg';

Replace svg with png

// graphics format to use: svg or png
$graph_format='png';