CentOS6.3环境下实战Linux开源流量监控软件Bandwidthd

简介:
+关注继续查看

bandwidthd在任何一台电脑可以通过web界面用浏览器查看经过网关的各个ip流量,而且是分协议,分颜色显示,已经有直观的图象曲线.

在日常维护中网管人员最头痛的是内部网经常有人在大量传送文件而导致本来可怜的带宽变得更加缓慢.如果在网关上装上bandwidthd ,就可以追踪的是各个的 IP 的流量,而且可以用图象曲线显示各个ip的相应不同协议显示,还能分时段查看
例如:包含FTPHTTPP2PTCPUDPICMP协议的各自流量,IP为统计对象.

 

1、基本编译组件安装

[root@localhost ~]# yum install gcc cpp glibc glibc-devel gcc-c++

 

2.PCAP/PNG/GD Library(图像处理库)

[root@localhost ~]# yum install libpcap libpcap-devel libpng libpng-devel gd gd-devel

 

3、安装httpd

[root@localhost ~]# yum install httpd mod_ssl

[root@localhost ~]# service httpd start

[root@localhost ~]# chkconfig httpd on

 

4、下载bandwidthd

[root@localhost ~]#

wget http://jaist.dl.sourceforge.net/project/bandwidthd/bandwidthd/bandwidthd%202.0.1/bandwidthd-2.0.1.tgz

 

5、安裝bandwidthd

解压bandwidthd

[root@localhost ~]# tar -zxvf bandwidthd-2.0.1.tgz

编译

[root@localhost ~]#cd bandwidthd-2.0.1

[root@localhost bandwidthd-2.0.1]# ./configure

[root@localhost bandwidthd-2.0.1]# make;make install

 

[root@localhost ~]# ll /usr/local/bandwidthd

总用量 64

-rwxr-xr-x 1 root root 53320 3  19 15:15 bandwidthd   //启动bandwidthd文件

drwxr-xr-x 2 root root  4096 3  19 15:51 etc          //配置文件

drwxr-xr-x 2 root root  4096 3  19 15:25 htdocs       //web访问目录,可以作一个虚拟主机指过来

 

6、修改bandwidthd配置文件

[root@localhost ~]# 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.1.3.0 255.255.255.0       #设置监控的网段

#subnet 192.168.0.0/24

subnet 172.16.1.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"  #(这是你要检测的网卡ethxany(所有),可以调整为对应的网络连接设备)

 

###################################################

# 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   #网页刷新时间

:wq               #保存

 

7、在web 主目录下做bandwidthd软连接,执行

[root@localhost ~]# cd /var/www/html/

[root@localhost html]# ln -s /usr/local/bandwidthd/htdocs bandwidthd

 

8、启动bandwidthdhttpd

[root@localhost ~]#cd /usr/local/bandwidthd

[root@localname bandwidthd]#./bandwidthd

[root@localhost bandwidthd]# service httpd restart

 

9、设定开机自动启动 bandwidthd

[root@localhost ~]# vim /etc/rc.local

在最后添加内容:

#bandwidthd流量监控

/usr/local/bandwidthd/bandwidthd

 

11、过几分钟,就可以浏览bandwidthd 生成的图形报表

http://IP/bandwidthd

 




本文转自 yhw85 51CTO博客,原文链接:http://blog.51cto.com/yanghuawu/1160334,如需转载请自行联系原作者

相关文章
|
13天前
|
机器学习/深度学习 监控 网络协议
Linux流量监控工具使用总结 - iftop
Linux流量监控工具使用总结 - iftop
22 0
|
6月前
|
运维 监控 Shell
shell脚本之---linux服务器流量监控利器
shell脚本之---linux服务器流量监控利器
|
监控 Linux 网络协议
Linux流量监控工具 - iftop
Linux流量监控工具 - iftop 界面上面显示的是类似刻度尺的刻度范围,为显示流量图形的长条作标尺用的。 中间的这两个左右箭头,表示的是流量的方向。 TX:发送流量 RX:接收流量 TOTAL:总流量 Cumm:运行iftop到目前时间的总流量 peak:流量峰...
1674 0
|
监控 Linux 网络安全
Linux服务器---流量监控ntop
Ntop      Ntop是一款类似于sniffer的流量监控工具,它显示出的流量信息比mrtg更加详细。1、安装一些依赖软件      [root@localhost bandwidthd]# yum install -y gcc libpcap-devel libpcap libtool automake autoconf gdbm gdbm-devel libevent libevent-devel rrdtool rrdtool-devel zlib zlib-devel2、安装geoip软件,此软件有多个依赖,可以在https://centos.pkgs.org下载。
1609 0
|
监控 Linux Apache
Linux服务器---流量监控webalizer
webalize      webzlizer是一个免费的web server分析工具,它能够分析apache、ftp等日志,将结果以html形式展示。1、安装一些依赖软件      [root@localhost bandwidthd-2.
1516 0
|
监控 Linux
Linux服务器---流量监控MRTG
MRTG      MRTG可以分析网络流量,但是它必须依赖SNMP协议。将收集到的数据生成HTML文件,以图片的形式展示出来1、安装一些依赖软件      [root@localhost bandwidthd-2.
1692 0
|
Web App开发 监控 Linux
Linux服务器---流量监控bandwidthd
Bandwidthd      Bandwidthd是一款免费的流量监控软件,它可以用图标的方式展现出网络流量行为,并且可区分出ftp、tcp等各种协议的流量。1、安装一些依赖软件      [root@localhost bandwidthd-2.
2924 0
|
机器学习/深度学习 监控 Linux
|
监控 Linux 机器学习/深度学习
相关产品
云迁移中心
推荐文章
更多