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,如需转载请自行联系原作者

相关文章
|
2天前
|
关系型数据库 应用服务中间件 Linux
Linux云服务器如何搭建LNMP环境
LNMP环境是Linux系统中常用的Web服务架构,由Linux、Nginx、MySQL/MariaDB和PHP组成,适用于高效托管动态网站。本文以CentOS 7为例,详细介绍了LNMP环境的搭建步骤,包括Nginx、MariaDB和PHP的安装与配置,以及最终通过创建`index.php`文件验证环境是否成功部署。具体操作涵盖配置YUM仓库、安装服务、编辑配置文件、启动服务等关键步骤,确保用户能够顺利搭建并运行LNMP环境。
25 1
Linux云服务器如何搭建LNMP环境
|
2月前
|
Ubuntu Linux Shell
(已解决)Linux环境—bash: wget: command not found; Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
(已成功解决)Linux环境报错—bash: wget: command not found;常见Linux发行版本,Linux中yum、rpm、apt-get、wget的区别;Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
669 68
(已解决)Linux环境—bash: wget: command not found; Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
|
2天前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
12 0
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
|
2月前
|
消息中间件 Java Kafka
【手把手教你Linux环境下快速搭建Kafka集群】内含脚本分发教程,实现一键部署多个Kafka节点
本文介绍了Kafka集群的搭建过程,涵盖从虚拟机安装到集群测试的详细步骤。首先规划了集群架构,包括三台Kafka Broker节点,并说明了分布式环境下的服务进程配置。接着,通过VMware导入模板机并克隆出三台虚拟机(kafka-broker1、kafka-broker2、kafka-broker3),分别设置IP地址和主机名。随后,依次安装JDK、ZooKeeper和Kafka,并配置相应的环境变量与启动脚本,确保各组件能正常运行。最后,通过编写启停脚本简化集群的操作流程,并对集群进行测试,验证其功能完整性。整个过程强调了自动化脚本的应用,提高了部署效率。
【手把手教你Linux环境下快速搭建Kafka集群】内含脚本分发教程,实现一键部署多个Kafka节点
|
3月前
|
缓存 Ubuntu Linux
Linux环境下测试服务器的DDR5内存性能
通过使用 `memtester`和 `sysbench`等工具,可以有效地测试Linux环境下服务器的DDR5内存性能。这些工具不仅可以评估内存的读写速度,还可以检测内存中的潜在问题,帮助确保系统的稳定性和性能。通过合理配置和使用这些工具,系统管理员可以深入了解服务器内存的性能状况,为系统优化提供数据支持。
140 4
|
3月前
|
运维 监控 Linux
服务器管理面板大盘点: 8款开源面板助你轻松管理Linux服务器
在数字化时代,服务器作为数据存储和计算的核心设备,其管理效率与安全性直接关系到业务的稳定性和可持续发展。随着技术的不断进步,开源社区涌现出众多服务器管理面板,这些工具以其强大的功能、灵活的配置和友好的用户界面,极大地简化了Linux服务器的管理工作。本文将详细介绍8款开源的服务器管理面板,包括Websoft9、宝塔、cPanel、1Panel等,旨在帮助运维人员更好地选择和使用这些工具,提升服务器管理效率。
|
3月前
|
关系型数据库 MySQL Linux
Linux环境下MySQL数据库自动定时备份实践
数据库备份是确保数据安全的重要措施。在Linux环境下,实现MySQL数据库的自动定时备份可以通过多种方式完成。本文将介绍如何使用`cron`定时任务和`mysqldump`工具来实现MySQL数据库的每日自动备份。
285 3
|
3月前
|
监控 关系型数据库 MySQL
Linux环境下MySQL数据库自动定时备份策略
在Linux环境下,MySQL数据库的自动定时备份是确保数据安全和可靠性的重要措施。通过设置定时任务,我们可以每天自动执行数据库备份,从而减少人为错误和提高数据恢复的效率。本文将详细介绍如何在Linux下实现MySQL数据库的自动定时备份。
154 3
|
安全 Linux 测试技术
配置Goby工具环境(win,linux,macOS)
配置Goby工具环境(win,linux,macOS)
903 2