Install vnstat
tar -zxvf vnstat-1.xx.tar.gz
Compile and install
make all
make install
Use vnstat
create new database
vnstat -u -i eth0
database is created under /var/lib/vnstat/eth0
Setup cron to collect data
copy from examples/vnstat.cron
#vnstat
#vnstat -i eth0
#vnstat -d
#vnstat -m
rx = recieved
tx = transmitted