Foreword
简单统计一下网口流量
vnstat
https://humdi.net/vnstat/
$ vnstat --help
vnStat 2.10 by Teemu Toivola
-5, --fiveminutes [limit] show 5 minutes
-h, --hours [limit] show hours
-hg, --hoursgraph show hours graph
-d, --days [limit] show days
-m, --months [limit] show months
-y, --years [limit] show years
-t, --top [limit] show top days
-b, --begin set list begin date
-e, --end set list end date
--oneline [mode] show simple parsable format
--json [mode] [limit] show database in json format
--xml [mode] [limit] show database in xml format
--alert
alert if limit is exceeded
-tr, --traffic [time] calculate traffic
-l, --live [mode] show transfer rate in real time
-i, --iface select interface (default: eth0)
Use "--longhelp" or "man vnstat" for complete list of options.
安装vnstat
yum install vnstat -y
apt-get install vnstat -y
一般网口都是eth0,创建网口统计
vnstat --create -i eth0
不排除某些linux是特殊名称
vnstat --create -i enp0s3
设置开机启动并重启
systemctl enable vnstat
systemctl restart vnstat
使用
月统计
vnstat -m
日统计
vnstat -d
$ vnstat
Database updated: 2018-10-21 20:11:20
eth0 since 2010-12-16
rx: 144.21 GB tx: 380.53 GB total: 524.74 GB
monthly
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
2018-09 1.82 GB | 7.99 GB | 9.81 GB | 32.52 kbit/s
2018-10 1.71 GB | 7.64 GB | 9.35 GB | 44.80 kbit/s
------------------------+-------------+-------------+---------------
estimated 2.56 GB | 11.41 GB | 13.97 GB |
daily
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
yesterday 72.69 MB | 333.94 MB | 406.63 MB | 39.48 kbit/s
today 67.21 MB | 279.75 MB | 346.96 MB | 40.05 kbit/s
------------------------+-------------+-------------+---------------
estimated 79.92 MB | 332.65 MB | 412.57 MB |
No package xxx available
可能遇到没有安装eple
No package epel-release available
下载安装
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
Summary
…
Quote
https://blog.csdn.net/qq_32828933/article/details/88656414
https://humdi.net/vnstat/