Linux VPS installs vnStat for traffic monitoring

Linux VPS installs vnStat for traffic monitoring

Debian 7 32-bit installation is successful:

one,
1. Install vnStat 1.10

 wget https://zhujiwiki.com/wp-content/uploads/2016/11/vnstat-1.10.tar.gz tar xvzf vnstat-1.10.tar.gz cd vnstat-1.10 make make install

2. Install vnStat 1.15

 wget https://zhujiwiki.com/wp-content/uploads/2016/11/vnstat-1.15.tar.gz tar xvzf vnstat-1.15.tar.gz cd vnstat-1.15 ./configure --prefix=/usr --sysconfdir=/etc && make make install

2. Establish statistical data
1. Generate data (check the network card through ifconfig or ip addr. If the network card is not etho, modify the /etc/vnstat.conf file)

 /usr/bin/vnstat -u -i eth0

or

 vnstat -u -i eth0

2. Create a new vnstat file

 vi /etc/cron.d/vnstat

Manually add the following code:

 0-55/5 * * * * root vnstat -u -i eth0 0-55/5 * * * * root vnstat --dumpdb -i eth0 >/var/lib/vnstat/vnstat_dump_eth0

3. View statistics using PHP

Enter the website directory, such as /home/wwwroot/zhujiwiki.com
Install vnstat1.4

 wget https://zhujiwiki.com/wp-content/uploads/2016/07/362406408.zip unzip 362406408.zip

Install vnstat1.5.2

 wget https://zhujiwiki.com/wp-content/uploads/2016/12/2212366636.zip unzip 2212366636.zip

Then check the traffic through domain name/vnstat.

4. View the current real-time traffic under the command line

 vnstat -l

View daily traffic statistics

 vnstat -d

View monthly traffic statistics

 vnstat -m

View traffic reports

 vnstat

View the real-time traffic of a specific network card

 vnstat -l -i eth0

In addition, the amount of traffic used has little to do with the bandwidth you use.

5. Uninstall vnstat
Enter the vnstat directory

 make uninstall

Official website: https://github.com/vergoh/vnstat/

<<:  BudgetVM: 5% off dedicated servers

>>:  HostMyBytes: $20/year/512MB/25GB space/1000GB traffic/KVM/Los Angeles

Recommend

PQS 512MB RAM 500Mbps Unlimited Native IP Taiwan BGP KVM VPS Review

Details: PQS: 118 yuan/month/512MB memory/10GB SS...

Introduction to US Host SiteGround

1. Introduction to SiteGround SiteGround is an Am...

Hosthatch 2014 New Year's Day 35% discount

之前介紹過:HostHatch:$4/月/256MB內存/10GB SSD空間/2TB流量/Open...

BandwagonHost 512MB RAM Los Angeles QNET KVM VPS Review

Details: BandwagonHost: $19.99/year/512MB memory/...