Install bandwidth monitor vnstat
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, so vnStat can be used without root permissions. However at least a 2.2.x kernel is required.
- Install vnStat
wget http://humdi.net/vnstat/vnstat-1.7.tar.gz
tar zxvf vnstat-1.7.tar.gz
cd vnstat-1.7
make
make install - Create databases for NICs
vnstat -u -i eth0
vnstat -u -i eth1 - Set a cronjob to check bandwidth usage
Add a crontab job entry for vnStat.
crontab -e
and add the following line
*/5 * * * * /bin/vnstat -u - Install the frontend
cd /var/www/
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz
tar zxvf vnstat_php_frontend-1.4.1.tar.gz
mv vnstat_php_frontend-1.4.1 vnstat
Edit vnstat/config.php and adjust the following lines to your preference:
$iface_list = array('eth0', 'eth1');
$iface_title['eth0'] = 'Extern';
$iface_title['eth1'] = 'Intern';
$vnstat_bin = '/usr/bin/vnstat';
Finally we open our browser and type
You should see something like this
vnstat