vnstat-1.4.tar.gz安装与配置
1、到download.chinaunix.net下载vnstat-1.4.tar.gz
2、下载 http://soft.vpser.net/status/vnstat/vnstat_php_frontend-1.5.1.tar.gz
3、安装
tar zxvf vnstat-1.4.tar.gz
cd vnstat-1.4
Make
Make install
如果64位平台上编译的话用make 64bit命令
这样就安装好了!
将第二步下载的vnstat_php_frontend-1.5.1.tar.gz
1、tar zxvf vnstat_php_frontend-1.5.1.tar.gz
2、mv vnstat_php_frontend-1.5.1 /你的网站根目录下/vnstat
cd /你的网站根目录下/vnstat
vi config.php
$locale = ‘en_US.UTF-8′;
$language = ‘en’; 这里要改
// list of network interfaces monitored by vnStat
$iface_list = array(‘eth0′, ‘eth1′);
//
// optional names for interfaces
// if there’s no name set for an interface then the interface identifier
// will be displayed instead
//
$iface_title['eth0'] = ‘Internal’;
$iface_title['eth1'] = ‘Internal’; 这是添加的
//$iface_title['sixxs'] = ‘SixXS IPv6′;
//
// There are two possible sources for vnstat data. If the $vnstat_bin
// variable is set then vnstat is called directly from the PHP script
// to get the interface data.
//
// The other option is to periodically dump the vnstat interface data to
// a file (e.g. by a cronjob). In that case the $vnstat_bin variable
// must be cleared and set $data_dir to the location where the dumps
// are stored. Dumps must be named ‘vnstat_dump_$iface’.
//
// You can generate vnstat dumps with the command:
// vnstat –dumpdb -i $iface > /path/to/data_dir/vnstat_dump_$iface
//
$vnstat_bin = ‘/usr/bin/vnstat’;
$data_dir = ‘/var/lib/vnstat’; 数据库位置
// graphics format to use: svg or png
$graph_format=’ png’;
// Font to use for PNG graphs
define(‘GRAPH_FONT’,dirname(__FILE__).’/VeraBd.ttf’);
// Font to use for SVG graphs
define(‘SVG_FONT’, ‘Verdana’);
// Default theme
define(‘DEFAULT_COLORSCHEME’, ‘light’);
?>
;
6、建立数据库
/usr/bin/vnstat -u -i eth0
/usr/bin/vnstat -u -i eth1
如果是基于apache的做访问控制
vi http.conf
<location /vnstat>
Order deny,allow
Allow from all
authtype basic
authname “vnstat”
authuserfile /web/vnstat/htpasswd.users
require valid-user
</location>
htpasswd -c /网站根目录/vnstat/htpasswd.users
8、访问http://ip/vnstat

