3. 安装bandwidth
tar zxvf bandwidthd-2.0.1.gz
cd bandwidthd-2.0.1
./configure –prefix=/usr
make
make install
4. 配置bandwidthd
4.1使用schema.postgresql 创建连接并生成文件
在bandwidthd-2.0.1文件夹下输入以下命令行:
psql mydb netuser < schema.postgresql #经过测试,这个不执行也可以
在bandwidthd.conf中添加参数
pgsql_connect_string "user = netuser dbname = mydb host = localhost"
sensor_id "netuser.BK3.localdomain"
graph false
recover_cdf false
5.启动bandwidthd
/usr/bandwidth/bandwidth
6. Web Server Setup:
cd /tmp #进入临时文件夹
cd /bandwidthd-2.0.1+cvs20090917 #进入bandwidthd文件夹,此文件夹是在安 #装bandwidthd-pgsql时产生的,如果没有可以从bandwidthd-2.0.1+cvs20090917包 #中获得。
sudo mv phphtdocs /var/www/monitor #将phphtdocs文件夹移动到/var/www/ #下并改名为monitor,此文件夹中的php程序是用来读取数据库中的数据使用的。
cd /var/www/monitor #进入monitor文件夹
sudo rm index.php #删除主页,此页不是我们需要的页面
sudo mv sensors.php index.php #将sensors.php文件夹改名为index.php,此页是#我们需要的主页,或者可以使用源码中的phphtdocs文件夹,不需要这两步。
sudo vi config.conf #修改配置文件
修改pgsql_connect_string "user = netuser dbname = mydb"一行,
以下是bandwidthd中README中关于网站设置的描述:
也可以使用上一篇提到的方式来配置php程序
1. Copy the contents of phphtdocs into your web tree some where.
2. Edit config.conf to set your db connect string
You should now be able to access the web application and see you graphs. All graphing
is done by graph.php, all parameters are passed to it in it's url. You can create
custom urls to pull custom graphs from your own index pages, or use the canned
reporting system.
In addition, you should schedule bd_pgsql_purge.sh to run every so often. I recomend
running it weekly. This script outputs sql statements that aggregate the older
data points in your database in order to reduce the amount of data that needs to
be slogged through in order to generate yearly, monthly, and weekly graphs.
至此,安装配置完成,可以访问此网站来查看bandwidthd搜集的数据
http://ip/monitor
