[FreeBSD] 安裝基本mrtg主機流量統計圖

  • 主機資訊 FreeBSD 6.1-RELEASE
  • 安裝步驟
cd /usr/ports/net-mgmt/net-snmp; make install clean

cd /usr/ports/net-mgmt/mrtg; make install clean
這2個安裝好,其實基本上就已經可以使用了 在 /etc/rc.conf 加上
snmpd_enable="YES"
snmpd_flags="-a -p /var/run/snmpd.pid"
snmptrapd_enable="YES"
snmptrapd_flags="-a -p /var/run/snmptrapd.pid"
修改 snmpd.conf 檔 目錄在 /usr/local/share/snmp/snmpd.conf

com2sec local localhost public com2sec lan 192.168.100.0/24 public group RWGroup v1 local group ROGroup v1 lan view all included .1 80 access RWGroup “” any noauth prefix all all all access ROGroup “” any noauth prefix all none none 紅色部份,盡量不要用 public ,因為這樣別人可以猜到你的mrtg設定 修改好存檔

/usr/local/etc/rc.d/snmpd start
然後進行流量偵測,網路卡流量 cfgmaker public@localhost 如果沒有錯誤訊息,那就是成功了,把結果輸出到資料夾 cfgmaker public@localhost > /usr/local/etc/mrtg/mrtg.cfg 修改 /usr/local/etc/mrtg/mrtg.cfg # for UNIX

Language:Big5 =============================================== 修改好存檔,然後執行,產生mrtg報表

/usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg vi /etc/crontab 加入 */5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg #每5分鐘統計一遍 產生mrtg的index.htm

indexmaker 
--title='MRTG - 網路流量分析' 
--addhead='


' 
--output /usr/local/www/data-dist/mrtg/index.htm 
--columns=1 
--nolegend 
/usr/local/etc/mrtg/mrtg.cfg

Photobucket - Video and Image Hosting


See also