Article Title: View your network using vnStat to monitor broadband traffic. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories. many articles have introduced how to monitor bandwidth in Windows operating systems, this article discusses how to monitor network bandwidth in Linux.
For various reasons, understanding the bandwidth utilization of the network is a good thing, especially when the bandwidth record is necessary (for example, when you pay for Internet services based on the amount of bandwidth used) it is even more important.
A powerful monitoring tool in Linux is vnStat, which can be downloaded from http://humdi.net/vnstat. Some Linux releases may be bound with vnStat, but you 'd better compile the software based on the source program.
After downloading vnStat, process the package as follows:
$ Curl-O http://humdi.net/vnstat/vnstat-1.4.tar.gz $ Tar xvzf vnstat-1.4 $ Vnstat-1.4 cd $ Make $ Sudo make install |
Note that for the last line, if you compile on a 64-bit platform, use the make 64bit command instead.
Next, create a timer program to execute vnStat every five minutes to collect bandwidth utilization data. For example, use the following content to create/etc/cron. d/vnstat:
0-55/5 **** if [-x/usr/local/bin/vnstat] & ['ls /Var/lib/vnstat/| wc-l '-ge 1]; Then/usr/local/bin/vnstat-u; fi |
Here we assume that vnStat is installed in/usr/local and/etc/cron. d is used to run the timer program in the system. (This is the default location for most Linux releases ).
Next, initialize the database for each port you want to trace:
#/Usr/local/bin/vnstat-u-I eth0 #/Usr/local/bin/vnstat-u-I eth1 |
Once this is done, the timer takes over the rest of the work. You only need to wait for the timer program to run several times to view the data utilization:
# Vnstat-I eth1 -- short Rx/tx/total/estimated Eth1: Yesterday 82.15 Mbit/s 809.36 Mbit/s 891.52 Mbit/s Today 83.20 MB/704.07 MB/787.28 MB/907 MB |
However, a PHP front-end can be used now, and it is easy to configure. it allows users to view data in web graphics, and users can download data from the vnStat Web site. There are multiple options to choose from. you can use this software to view the communication data for the current day and the current month. I hope this software will help you manage your network.