Table of Contents
Vnstat
= vnstat - Network Traffic Logger and Monitor =
vnstat keeps a daily log of network traffic for a specific device (eth0). Information is simply taken from /proc every 5 minutes via cron vnstatd daemon and saved to /var/lib/vnstat
What is good about vnstat, unlike munin or mrtg, is that vnstat keeps an accurate and numerical account of all network traffic. This is extremely useful if you have to watch bandwidth usage!!
Install and Config vnstat
apt-get install vnstat
#check in /etc/cron.d/ for vnstat
#You may get the error:
Starting vnStat daemon: vnstatdZero database found, exiting
ifconfig #check for the current network interface been used.
vnstat #if its the first time running vnstat, it will tell you to config vnstat to use an interface. #The following is the syntax used to monitor an interface: vnstat -u -i eth0 /etc/init.d/vnstat start
Check Network Traffic and Bandwidth Used
vnstat #With no options, shows the totals.
vnstat -h #Show traffic for the last 24 hours. vnstat -d #Show traffic for days. vnstat -t #Show all time top10 traffic days. vnsatt -w #Show traffic for 7 days. vnstat -m #Show traffic for months.
vnstat -tr #Show an immediate, real time sample, over a period of 5 (default if no number is given) seconds.
Links: