View your Traffic Quota with vnstat - Network monitoring
If you are running a virtual private server, you might be restricted by a bandwidth quota. To view your current traffic consumption, you can install a tool called vnstat.
What is vnstat for?
Most of your installed services on your virtual private server generate bandwidth traffic. You generally can distinguish the traffic in transmit tx and receive rx.
With vnstat, you can monitor all data by month, week, hour and day. It is also very lightweight in using system resources. So, the CPU and Memory usage is low.
How can I install this tool?
If you haven't already done, enable EPEL repositories on the CentOS host.
yum -y install epel-release && yum -y update
Use the following command to install vnstat
yum -y install vnstat
The next step is to register this tool as a service. The OS will execute the background task on every boot.
systemctl enable vnstat && systemctl start vnstat && chkconfig vnstat on
You are now ready to use it. Here are some useful examples:
#overview since start, monthly and daily
vnstat
#live transfer rate
vnstat -l
#overview monthly
vnstat -m
#overview last days
vnstat -d
You are finished with the installation of vnstat.
Tested on:
- vnstat: 1.15
Credits:
- Post photo by Jordan Harrison on Unsplash