Vnstat
From Leo's Notes
This page was last edited on 23 March 2015, at 17:00.
Installation
The following steps should work for CentOS/ScientificLinux/RHEL.
wget http://humdi.net/vnstat/vnstat-1.11.tar.gz
tar -xzf vnstat-1.11.tar.gz
cd vnstat-1.11
make
make install
vnstat --testkernel
/bin/cp examples/init.d/centos/vnstat /etc/init.d/vnstat
chkconfig --levels 234 --add vnstat
vnstat -u -i eth0
/etc/init.d/vnstat start
Usage
You do not need to interface with vnstat directly since vnstat will create a cronjob in /etc/cron.d/vnstat which will run /usr/sbin/vnstat.cron as nobody every 5 minutes.
However, you may need to fix or initialize the database.
Initializing Database
To initialize a database for a specific device:
vnstat -u -i $NetInterface
Force Update
sudo -u /usr/sbin/vnstat.cron --force