Mar 172008

One of the advantages of vnStat is that it can be installed and run as a Non-Root user. This can be of a great help to query vnStat of scripts or allow operators to run the vnStat utility.

Download vnStat

Download vnStat from here

DebianSystem# wget

Unzip & Untar the downloaded the file

DebianSystem# tar -zxvf vnstat-1.6.tar.gz

ChangeDirectory & Compile

DebianSystem# cd vnstat-1.6

DebianSystem:/vnstat-1.6# make

Create Database Directory

If there was no errors, copy src/vnstat to some directory included in $PATH variable(say ~/bin/) and create the database directory.

DebianSystem# cp src/vnstat ~/bin/
DebianSystem# cp cfg/vnstat.conf ~/.vnstatrc
DebianSystem# mkdir ~/.vnstat

Test Kernel compatibility

DebianSystem# vnstat –testkernel

Edit Config file & Add Database Directory

DebianSystem# vi ~/.vnstatrc


DatabaseDir “/var/lib/vnstat”

and replace with

DatabaseDir “/pathtoyourhomedir/.vnstat”

and save the file.

Next every interface that should be monitored needs to be added to vnStat. This creates a database for each of the interface.

DebianSystem# vnstat -u -i eth0

where eth0 is the interface name. Change it to the interface on your system.

Add a crontab job entry for vnStat.

DebianSystem# crontab -e

and add the following line

*/5 * * * * ~/bin/vnstat -u

Allow it to collect enough traffic information after which run vnstat

DebianSystem# vnstat

Also, in any case you can check the config file ~/.vnstatrc for interface and other settings.

For more options and examples for the command, click here

 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>