Here is how to keep log of daily network traffic on Dedicated Servers :
* It is a console-base network traffic monitor for Linux (perfect tool for remote Linux box hosted at ISP)
* It keeps a log of daily and monthly network traffic for the selected network interface(s).
* It collects all data from /proc file system it means normal user can monitor traffic (no need to run vnstat as a root user)
* Easy to setup & configure
* Ease of use
Step # 1: Install vnstat
Debian user can install vnstat using apt-get command
# apt-get install vnstat
Step # 2: Enable vnstat
Once installed you need to create a database with following command:
# vnstat -u -i eth0
Where,
u :forces a database update for interface or creates the database if it doesn’t exist
i eth0 : use to specify interface
Please note that it will start to collect data via cronjob
0-55/5 * * * * root /usr/bin/vnstat -u
You do not have to install cronjob yourself; it should be automatically configure by apt-get.
Step # 3 View statistics
Display default traffic statistics
$ vnstat
Display daily traffic statistics
$ vnstat -d
Display monthly traffic statistics:
$ vnstat -m
Display all time top10 traffic days:
$ vnstat -t
Try help option to get all query options:
$ vnstat –help