什么是vnstat
引用官方原文
vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won’t actually be sniffing any traffic and also ensures light use of system resources.
This program is open source / GPL’ed and can be installed either as root or as a single user. Better instructions are included in the README. Feel free to send comments by email (remove the spamfilter) or try contacting me from irc (Vergo @ IRCNet).
简单说就是一个在ssh下可以很方便查看流量使用的一款功能强大的工具
安装vnstat
因为本人惯用CentOS,一般的测试都是在CentOS上测试
安装epel
yum -y install epel-release
安装vnstat
yum -y install vnstat
安装成功
接下来改生成一个数据库,不然怎么记录流量数据
vnstat -u -i eth0
eth0 是默认网卡,如果想监控别的网卡或者是默认网卡名称不对,更改即可
接下来肯定是启动服务啦
service vnstat start
设置个开机启动
chkconfig vnstat on
最后
你需要耐心等待,服务器流量大了它才会显示
.
是不是很直观?
发表评论