1. 程式人生 > >Linux伺服器---流量監控bandwidthd

Linux伺服器---流量監控bandwidthd

Bandwidthd

        Bandwidthd是一款免費的流量監控軟體,它可以用圖示的方式展現出網路流量行為,並且可區分出ftp、tcp等各種協議的流量。

1、安裝一些依賴軟體

[[email protected] bandwidthd-2.0.1]# yum install -y libpng libpng-devel gd gd-devel gcc libpcap-devel

2、下載bandwidthd軟體(https://sourceforge.net/projects/bandwidthd/files/bandwidthd/bandwidthd 2.0.1/

 

3、解壓bandwidthd。

[[email protected] ~]# tar -xzvf bandwidthd-2.0.1.tar.gz

 

4、安裝。Bandwidthd需要進行編譯安裝,首先要執行configure檔案,生成makefile,然後在編譯、安裝

[[email protected] bandwidthd-2.0.1]# ./configure

[[email protected] bandwidthd-2.0.1]# make

[[email protected] bandwidthd-2.0.1]# make install

 

5、修改配置檔案“/usr/local/bandwidthd/etc/bandwidthd.conf”,設定監聽的網段和網絡卡

[[email protected] bandwidthd-2.0.1]# gedit /usr/local/bandwidthd/etc/bandwidthd.conf 

 #subnet 10.0.0.0 255.0.0.0

#subnet 192.168.0.0/16

#subnet 172.16.0.0/12

subnet 192.168.0.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 "eth0"     //監聽網絡卡

6、建立連結,在apache網頁根目錄建立一個連結,指向bandwidthd,這樣可以快速開啟bandwidthd

[[email protected] bandwidthd-2.0.1]# cd /var/www/html/

[[email protected] html]# ln -s /usr/local/bandwidthd/htdocs bandwidthd

7、啟動bandwidthd

[[email protected] html]# cd /usr/local/bandwidthd/

[[email protected] bandwidthd]# ./bandwidthd 

 

8、在瀏覽器輸入“127.0.0.1/bandwidthd”開啟bandwidthd。請確保你已經開啟了httpd服務。

        

9、設定bandwidthd開機啟動

[[email protected] html]# gedit /etc/rc.local

touch /var/lock/subsys/local

INITTY=/dev/tty[1-8]

for tty in $INITTY; do

    setleds -D +num < $tty

done

/usr/local/bandwidthd/bandwidthd