vnstat 查看服务器带宽统计命令
vnStat是一个Linux下的网络流量监控软件,它记录指定网卡每日的传输流量日志.
它并非基于网络包的过滤,而是分析文件系统- /proc, 所以vnStat无需root的权限就可使用.
,它还自带了 vnstati 命令,通过它可以直接可以输出流量统计图.
#先安装epel源 [root@vpn ~]# yum install epel-release -y #yum安装vnstat [root@vpn ~]# yum install vnstat -y #创建监控数据库(eth0改成你需要监控的网卡) vnstat -u -i eth0 #启动服务并设置开机启动 service vnstat start chkconfig vnstat on #查看帮助 [root@vpn ~]# vnstat --help vnStat 1.11 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 top10 -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@vpn ~]# vnstat Database updated: Wed Apr 5 22:37:51 2017 eth0 since 04/05/17 rx: 310 KiB tx: 1.38 MiB total: 1.68 MiB monthly rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- Apr '17 310 KiB | 1.38 MiB | 1.68 MiB | 0.03 kbit/s ------------------------+-------------+-------------+--------------- estimated -- | -- | -- | daily rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- today 310 KiB | 1.38 MiB | 1.68 MiB | 0.17 kbit/s ------------------------+-------------+-------------+--------------- estimated -- | -- | -- |
参考:http://www.vpswe.com/vps-jiaocheng/483.html