Traffic Monitor: vnStat
vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won't actually be sniffing any traffic and also ensures light use of system resources.
It's pretty easy to install vnStat, just run the following command in your console (for CentOS), and it is done.
Before create vnStat database, make sure which network interface you want to monitor, take eth0 for example.
It's done, and enjoy vnStat.
vnstat -h Show traffic statistics on a hourly basis for the last 24 hours.
vnstat -d Show traffic statistics on a daily basis for the last 30 days.
vnstat -m Show traffic statistics on a monthly basis for the last 12 months.
vnstat -l Display current transfer rate for the selected interface in real time until interrupted. Statistics will be shown after interruption if the runtime was more than 10 seconds.
The commands above are commonly used, for detailed manual please take a look at official manual page.
If you encounter a problem of "eth0: Not enough data available yet.", please make sure vnStat is running. Here is the command of check the status:
If it wasn't running, run the follwoing command and you will able to get traffic information in 5 minutes.
Installation
It's pretty easy to install vnStat, just run the following command in your console (for CentOS), and it is done.
yum -y install vnstat
Create vnStat database
Before create vnStat database, make sure which network interface you want to monitor, take eth0 for example.
vnstat -u -i eth0
It's done, and enjoy vnStat.
Command Manual
vnstat -h Show traffic statistics on a hourly basis for the last 24 hours.
vnstat -d Show traffic statistics on a daily basis for the last 30 days.
vnstat -m Show traffic statistics on a monthly basis for the last 12 months.
vnstat -l Display current transfer rate for the selected interface in real time until interrupted. Statistics will be shown after interruption if the runtime was more than 10 seconds.
The commands above are commonly used, for detailed manual please take a look at official manual page.
If you encounter a problem of "eth0: Not enough data available yet.", please make sure vnStat is running. Here is the command of check the status:
/etc/init.d/vnstat status
If it wasn't running, run the follwoing command and you will able to get traffic information in 5 minutes.
/etc/init.d/vnstat start
Comments
Post a Comment