参考链接:
http://abdussamad.com/archives/154-Monitoring-bandwidth-usage-with-vnStat-under-CentOS-5-Linux.html
http://www.tchan4.com/main/2013/05/01/vnstat-and-vnstat-php-frontend-installation-centos/
脚本:
[bash]
#!/bin/bash
#64 bit
rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
yum -y install vnstat
#Test
vnstat -u -i eth0
#Remove eth0 file, nobody will create it later
rm -rf /var/lib/vnstat/eth0
#下载目录可以自定义
cd ~/packages
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz
tar -xzf vnstat_php_frontend-1.4.1.tar.gz
mkdir /home/www/vnstat
mv vnstat_php_frontend/* /home/www/vnstat
[/bash]
Tags: VPS