vnStat — Network Traffic Monitor
vnStat is a network traffic monitor for Linux that keeps a log of daily network traffic for the selected interface(s). vnStat isn’t a packet sniffer. The traffic information is analyzed from the /proc filesystem. That way vnStat can be used even without root permissions. However, at least a 2.2 series kernel is required.
To create a database for vnstat type in vnstat -u -i interface (ie, eth1), after the database is created, which is the first thing to do after a fresh install of vnstat, allow some time for the database to populate with information. After some time just type in vnstat to get a summary of your daily traffic.
vnstat –dumpdb will dump the whole database in a format that shold be easy to parse with most scripting langauge
vnstat -h will show traffic for the last 24 hours.
For more information about vnstat go to: http://humdi.net/vnstat/


