Site icon David Yin's Blog

Install vnstat on Centos at Burst.net to monitor the traffic

The traffic graphic on Burst.net portal is not correct. It is what Burst.net support stuff said. So I would like to install my own traffic monitoring service to track home much I use during the month.

vnStat is the one we are going to go through the installation.

The screen shot below is the report I have for last two weeks.

1) Install vnstat
SSH to VPS

wget http://humdi.net/vnstat/vnstat-1.11.tar.gz
tar xzvf vnstat-1.11.tar.gz
cd vnstat-1.11
make
make install

Until now, vnstat is installed, but it has no GUI for easily viewing.
So step 2 is install vnstat php frontend

2) Install vnstat php frontend

wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz
tar xzvf vnstat_php_frontend-1.5.1.tar.gz
cd vnstat_php_frontend-1.5.1
mkdir /home/yourname/yoursite/vnstat
cp -r . /home/yourname/yoursite/vnstat/
cd /home/yourname/yoursite/vnstat/
vi config.php

Edit config.php, change network interface to venet0
change data folder to $data_dir = ‘/var/lib/vnstat/’;

3) Add scheduled cron job to update the log database

cd /var/lib/vnstat
vi dump.sh
</pre>
Add following into dump.sh
<pre class="brush:shell">
vnstat -u -i venet0
vnstat -dumpdb -i venet0 &gt;/var/lib/vnstat/vnstat_dump_venet0

Add following into scheduled cron job to every hours

/bin/sh /var/lib/vnstat/dump.sh

Then the report will come like this when enter the address
http://yoursite/vnstat/

Exit mobile version