实战Linux开源流量监控软件Bandwidthd

  • A+
所属分类:lcx

标题:CentOS5环境下实战Linux开源流量监控软件Bandwidthd

内容:
1.基本编译组件安装
yum install gcc cpp glibc glibc-devel gcc-c++

2. PCAP/PNG/GD Library(图像处理库)
yum install libpcap libpng libpng-devel gd gd-devel

3.安装apache2
yum install httpd mod_ssl
chkconfig httpd on
service httpd start

4.下载bandwidthd
wget http://voxel.dl.sourceforge.net/project/bandwidthd/bandwidthd/bandwidthd%202.0.1/bandwidthd-2.0.1.tgz

5.解压缩bandwidthd
tar -xzvf bandwidthd-2.0.1.tgz

6.修改bandwidthd统计上限(预设为20,修改为100)
cd /usr/local/src/bandwidthd-2.0.1
vim graph.c

Top20修改为Top100 (有三个)
Counter

7.安裝bandwidthd
cd /usr/local/src/bandwidthd-2.0.1
./configure
make install

8.修改bandwidthd配置文件
vim /usr/local/bandwidthd/etc/bandwidthd.conf
####################################################
# Bandwidthd.conf
#
# Commented out options are here to provide
# documentation and represent defaults

# Subnets to collect statistics on. Traffic that
# matches none of these subnets will be ignored.
# Syntax is either IP Subnet Mask or CIDR
#subnet 10.0.0.0 255.0.0.0
#subnet 192.168.0.0/16
#subnet 172.16.0.0/12
subnet 184.82.43.0/24 #需要监控的网段

# Device to listen on
# Bandwidthd listens on the first device it detects
# by default. Run "bandwidthd -l" for a list of
# devices.
dev "any" #(这是你要检测的网卡,可以调整为对应的网络连接设备)

###################################################
# Options that don't usually get changed

# An interval is 2.5 minutes, this is how many
# intervals to skip before doing a graphing run
skip_intervals 1 #默认2.5 minutes 刷新

# Graph cutoff is how many k must be transfered by an
# ip before we bother to graph it
graph_cutoff 1024 #默认1M 以上的流量才有图形

#Put interface in promiscuous mode to score to traffic
#that may not be routing through the host machine.
promiscuous true #设置网卡在混杂模式中记录

#Log data to cdf file htdocs/log.cdf
output_cdf true #在bandwidthd目录中生成log2.cdf 以log.cdf格式数据记录

#Read back the cdf file on startup
recover_cdf true #在启动bandwidth时重新读取cdf的数据

#Libpcap format filter string used to control what bandwidthd see's
#Please always include "ip" in the string to avoid strange problems
filter "ip" #以ip为过滤对象

#Draw Graphs – This default to true to graph the traffic bandwidthd is recording
#Usually set this to false if you only want cdf output or
#you are using the database output option. Bandwidthd will use very little
#ram and cpu if this is set to false.
graph true #图形生成

#Set META REFRESH seconds (default 150, use 0 to disable).
meta_refresh 150 #网页刷新时间

9.建立 Apache 到 bandwidthd 软连接
cd /var/www/html
ln -s /usr/local/bandwidthd/htdocs bandwidthd

10.设定开机自动启动 bandwidthd
vim /etc/rc.local
加入/usr/local/bandwidthd/bandwidthd

11.过几分钟,就可以浏览bandwidthd 生成的图形报表了
http://IP/bandwidthd

文章来源于lcx.cc:实战Linux开源流量监控软件Bandwidthd

相关推荐: Windows 各个操作系统的版本号

1985 - Windows 1.0 1987 - Windows 2.0 1990 - Windows 3.0 1991 - Windows 3.1 1993 - Windows NT 3.0 1995 - Windows 95 1996 - Windows…

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: