Total Pageviews

Monday, 4 March 2013

架設Linux的流量監控軟體iptotal

Linux 流量控管不想要架設 SNMP 的話, 可以考慮使用 iptotal.

iptotal 簡介

iptotal 安裝設定

  1. sudo apt-get install iptotal
  2. sudo /etc/init.d/iptotal restart
  3. # 設定 Web 瀏覽, 在此採用 VirtualHost 設定
  4. sudo cp /etc/iptotal/apache.conf /etc/apache2/sites-enabled/iptotal
  5. sudo vim /etc/apache2/sites-enabled/iptotal
    <VirtualHost *:80>
        #Alias /iptotal /var/lib/iptotal/
        ServerName traffic.example.com
        DocumentRoot /var/lib/iptotal/
    
        <Directory /var/lib/iptotal>
            Options +FollowSymLinks
            AllowOverride None
            order allow,deny
            allow from all
            DirectoryIndex template.html
        </Directory>
    
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
        </Directory>
    
        # 若想要鎖密碼的話, iptotal.passwd 請自行用 htpasswd 建立
        <LocationMatch "/">
            AuthType Basic
            AuthName "Iptotal Traffic"
            AuthUserFile /etc/apache2/iptotal.passwd
            Require valid-user
        </LocationMatch>
    </VirtualHost>
  6. cd /var/lib/iptotal/
  7. sudo mkdir iptotal
  8. cd iptotal/
  9. sudo ln -s ../archive/ . # 修正資料路徑
  10. sudo ln -s ../images/ . # 修正圖片路徑
  11. sudo /etc/init.d/apache2 restart # 到此即完成.

iptotal 管理

  • 流量控管可見: http://traffic.example.com
  • 網頁版面修改可改此檔案: /var/lib/iptotal/template.html # /usr/share/iptotal/www/template.html