vnStat是一个Linux下的网络流量监控软件,它可以记录指定网卡每日的传输流量日志。需要注意的是它并非基于网络包的过滤而是分析 /proc, vnStat不需要root权限。
vnstat 命令用法
[root@upall ~]# vnstat --help
vnStat 1.14 by Teemu Toivola <tst at iki dot fi>
-q, --query query database
-h, --hours show hours
-d, --days show days
-m, --months show months
-w, --weeks show weeks
-t, --top10 show top 10 days
-s, --short use short output
-u, --update update database
-i, --iface select interface (default: eth0)
-?, --help short help
-v, --version show version
-tr, --traffic calculate traffic
-ru, --rateunit swap configured rate unit
-l, --live show transfer rate in real time
See also "--longhelp" for complete options list and "man vnstat".
[root@upall ~]# vnstat -q
rx / tx / total / estimated
eth0:
Jun '15 2.97 GiB / 24.33 GiB / 27.30 GiB
Jul '15 2.91 GiB / 23.38 GiB / 26.29 GiB / 52.73 GiB
yesterday 176.43 MiB / 1.23 GiB / 1.40 GiB
today 61.34 MiB / 405.61 MiB / 466.96 MiB / 0.99 GiB
[root@upall ~]# vnstat -h
eth0 11:00
^ t
| t
| t
| t
| t
| t
| t t
| t t t t t t t t
| t t t t t t t t t t t t t
| t t t t t t t t t t t t t t t t t t rt
-+--------------------------------------------------------------------------->
| 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11
h rx (MiB) tx (MiB) h rx (MiB) tx (MiB) h rx (MiB) tx (MiB)
12 9.18 50.24 20 8.03 62.96 04 2.88 7.36
13 5.51 30.11 21 8.09 87.86 05 2.69 9.15
14 7.52 53.69 22 7.22 67.08 06 3.72 26.90
15 7.40 68.87 23 6.32 49.88 07 5.57 17.86
16 8.02 69.96 00 5.17 32.22 08 3.95 27.61
17 6.47 66.43 01 4.23 21.07 09 6.34 40.79
18 5.63 50.17 02 2.82 10.04 10 20.01 187.17
19 6.22 60.18 03 3.97 25.45 11 0.00 0.00
[root@upall ~]# vnstat -t
eth0 / top 10
# day rx | tx | total | avg. rate
-----------------------------+-------------+-------------+---------------
1 06/26/2015 359.65 MiB | 6.18 GiB | 6.53 GiB | 633.80 kbit/s
2 06/27/2015 264.24 MiB | 3.66 GiB | 3.92 GiB | 380.16 kbit/s
3 07/06/2015 217.35 MiB | 2.58 GiB | 2.79 GiB | 271.28 kbit/s
4 07/13/2015 198.07 MiB | 2.37 GiB | 2.57 GiB | 249.21 kbit/s
5 07/08/2015 268.37 MiB | 2.02 GiB | 2.28 GiB | 221.69 kbit/s
6 07/09/2015 210.64 MiB | 1.81 GiB | 2.01 GiB | 195.48 kbit/s
7 06/28/2015 256.91 MiB | 1.69 GiB | 1.94 GiB | 187.96 kbit/s
8 06/25/2015 206.84 MiB | 1.56 GiB | 1.76 GiB | 170.63 kbit/s
9 07/04/2015 190.49 MiB | 1.45 GiB | 1.63 GiB | 158.52 kbit/s
10 07/07/2015 185.31 MiB | 1.43 GiB | 1.61 GiB | 156.19 kbit/s
-----------------------------+-------------+-------------+---------------
vnStat PHP frontend
vnStat PHP frontend 是 vnstat 的 WEB 扩展,可以直接通过浏览器查看,美化版的效果如下:
美化版下载地址:
美化版 vnStat PHP frontend,解压到站点目录中即可
<完>
