知乎專欄 | 多維度架構 | 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者” |
http://bandwidthd.sourceforge.net/
$ apt-cache search bandwidthd bandwidthd - Tracks usage of TCP/IP and builds html files with graphs bandwidthd-pgsql - Tracks usage of TCP/IP and builds html files with graphs $ sudo apt-get install bandwidthd ┌────────────────────────────────────────┤ BandwidthD ├────────────────────────────────────────┐ │ Bandwidthd needs to know which interface it should listen for traffic on. Only a single │ │ interface can be specified. If you want to listen on all interfaces you should specify the │ │ metainterface "any". Running "bandwidthd -l" will list available interfaces. │ │ │ │ Interface to listen on: │ │ │ │ any │ │ lo │ │ eth0 │ │ eth1 │ │ tun0 │ │ │ │ │ │ <Ok> │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ ┌────────────────────────────────────────┤ BandwidthD ├─────────────────────────────────────────┐ │ Bandwidthd can create graphs for one or several ip-subnets. Subnets are specified either in │ │ dotted-quad format (192.168.0.0 255.255.0.0) or in CIDR format (192.168.0.0/16) and │ │ separated by a comma. Example: 192.168.0.0/16, 10.0.0.0 255.0.0.0, 172.16.1.0/24. If you │ │ don't know what to specify then you can use 0.0.0.0/0 but it is strongly discouraged. │ │ │ │ Subnets to log details about: │ │ │ │ 10.8.0.2/32, 172.16.2.0/24, 10.8.0.0/24, 172.16.1.0/24_______________________________________ │ │ │ │ <Ok> │ │ │ └───────────────────────────────────────────────────────────────────────────────────────────────┘ $ sudo mkdir /www/bandwidth $ sudo vim /etc/bandwidthd/bandwidthd.conf htdocs_dir "/www/bandwidthd" $ sudo /etc/init.d/bandwidthd restart * Stopping BandwidthD bandwidthd [ OK ] * Starting BandwidthD bandwidthd [ OK ]
http://localhost/bandwidthd/index.html
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm # yum search bandwidthd bandwidthd.i386 : Tracks network usage and builds html and graphs # yum install bandwidthd # rpm -ql bandwidthd /etc/bandwidthd.conf /etc/httpd/conf.d/bandwidthd.conf /etc/rc.d/init.d/bandwidthd /usr/sbin/bandwidthd /usr/share/doc/bandwidthd-2.0.1 /usr/share/doc/bandwidthd-2.0.1/CHANGELOG /usr/share/doc/bandwidthd-2.0.1/README /usr/share/doc/bandwidthd-2.0.1/TODO /usr/share/doc/bandwidthd-2.0.1/phphtdocs /usr/share/doc/bandwidthd-2.0.1/phphtdocs/bd_pgsql_purge.sh /usr/share/doc/bandwidthd-2.0.1/phphtdocs/config.conf /usr/share/doc/bandwidthd-2.0.1/phphtdocs/details.php /usr/share/doc/bandwidthd-2.0.1/phphtdocs/footer.php /usr/share/doc/bandwidthd-2.0.1/phphtdocs/graph.php /usr/share/doc/bandwidthd-2.0.1/phphtdocs/include.php /usr/share/doc/bandwidthd-2.0.1/phphtdocs/index.php /usr/share/doc/bandwidthd-2.0.1/phphtdocs/legend.gif /usr/share/doc/bandwidthd-2.0.1/phphtdocs/logo.gif /var/www/bandwidthd /var/www/bandwidthd/htdocs /var/www/bandwidthd/htdocs/legend.gif /var/www/bandwidthd/htdocs/logo.gif </screen> <screen> # cat /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 # Device to listen on # Bandwidthd listens on the first device it detects # by default. Run "bandwidthd -l" for a list of # devices. #dev "eth0" ################################################### # 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 0 # Graph cutoff is how many k must be transfered by an # ip before we bother to graph it #graph_cutoff 1024 #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 false #Read back the cdf file on startup #recover_cdf false #Libpcap format filter string used to control what bandwidthd see's #Please always include "ip" in the string to avoid strange problems #filter "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
cd /etc/nginx/conf htpasswd -c -d htpasswd user_name server { listen 80; server_name monitor.example.com; root /var/www/bandwidthd/htdocs; index index.html; location / { try_files $uri $uri/ /index.html; auth_basic "Login"; auth_basic_user_file htpasswd; } }
CentOS rpmforge-release 安裝注意事項 | |
---|---|
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm yum install bandwidth rpmforge-release 中有一個bandwidth 是一個內從測試軟件 不是 bandwidthd # yum search bandwidth bandwidth.i386 : Artificial benchmark for measuring memory bandwidth |
tar zxvf bandwidthd-2.0.1.tgz cd bandwidthd-2.0.1 ./configure --prefix=/srv/bandwidthd-2.0.1 make make install