Vnstat
Installation
Vnstat should be available through the yum package manager via the EPEL repository.
Installing from Source
The following instructions will set up vnstat from source and should work for CentOS/ScientificLinux/RHEL linux distributions.
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.
Depending on how your network interfaces are named and the number of interfaces you have, you may need to fix or initialize the vnstat database.
Initializing Database
To initialize a database for a specific device:
vnstat -u -i $NetInterface
Force Update
sudo -u /usr/sbin/vnstat.cron --force
| ||||||