http://www.debianhelp.co.uk/snmp.htm
http://blog.miniasp.com/post/2009/02/Ubuntu-804-snmpd-installation-and-configuration-notes.aspx
http://dieabsorb.wordpress.com/2011/04/05/snmp-%E5%B0%8F%E8%A8%98/
SNMP - Simple Network Management Protocol
MRTG - Multi Router Traffic Grapher
# apt-get install snmp snmpd mrtg mrtg-contrib
出現詢問
Make /etc/mrtg.conf owned by and readable only by the MRTG user?
選擇Yes,讓一般使用者看不到 MRTG 的設定檔
# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
# snmpconf
如果是簡易設定,只要設定 Access Control Setup 的選項
Community name: public
即可,等 SNMP 可以運作之後再去詳細 config snmp
# /etc/init.d/snmpd restart
# snmpwalk -c public -v 1 localhost
''rocommunity public''
# cfgmaker --global 'WorkDir: /var/www/mrtg' --global "Refresh: 300" --global 'Options[_]: bits,growright' --global 'Language: big5' --output /etc/mrtg.cfg public@domain.name
# cfgmaker --global "WorkDir: /var/www/mrtg" --global "Refresh: 600" --global "Interval: 5" --global "WriteExpires: Yes" --global "Language: big5" --global "options[_]: bits" --ifdesc=descr --ifref=descr public@127.0.0.1 > /etc/mrtg.cfg
如果看到 SNMP Error: no response received 的訊息, 表示 snmpd.conf 還是沒有設好
# mrtg /etc/mrtg.cfg
執行三次,前兩次執行會出現 rateup 的警告,不用理。
# indexmaker --columns=1 --output=/var/www/mrtg/index.html --title='Traffic Info' /etc/mrtg.cfg
開啟網頁,EX: http://domain.name/mrtg/index.html
如果沒圖表出來,通常都是 SNMP 設定失敗
cd /usr/ports/net-mgmt/net-snmp; make install clean cd /usr/ports/net-mgmt/mrtg; make install clean
snmpd_enable="YES" snmpd_flags="-a -p /var/run/snmpd.pid" snmptrapd_enable="YES" snmptrapd_flags="-a -p /var/run/snmptrapd.pid"
cp /usr/local/share/snmp/snmpd.conf.example /usr/local/share/snmp/snmpd.conf
In /usr/local/share/snmp/snmpd.conf:
# sec.name source community com2sec local localhost public # can name other symbol at community column
# sec.model sec.name group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local
# incl/excl subtree mask view all included .1 80
# context sec.model sec.level match read write notif access MyRWGroup "" any noauth exact all all none
/usr/local/etc/rc.d/snmpd start
cfgmaker public@localhost
如果沒有錯誤訊息
cfgmaker public@localhost > /usr/local/etc/mrtg/mrtg.cfg
依照 Http Server Documents Root 建立網頁資料夾
mkdir /usr/local/www/apache22/data/mrtg
Modify /usr/local/etc/mrtg/mrtg.cfg
# for UNIX WorkDir: /usr/local/www/apache22/data/mrtg Language:Big5
/usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
Add into crontab
*/5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg # Every five minutes
indexmaker --title='MRTG - 網路流量分析' --addhead=' \ <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=utf-8">' \ --output /usr/local/www/apache22/data/mrtg/index.htm --columns=1 \ --nolegend /usr/local/etc/mrtg/mrtg.cfg
利用 rrdtools 繪出各網站的 ping 值
# aptitude install smokeping
設定檔放在 /etc/smokeping,其中主要設定檔為 config,修改 owner contact cgiurl mailhost to from 這些設定值。
一些文字設定:title、remark等。
之後是站台設定,「+」代表跟目錄,「++」表子目錄。
+ Local menu = Local title = Local Network ++ LocalMachine menu = Local Machine title = This own machine host = localhost + BBS menu = BBS title = BBS ++ Bahamut menu = Bahamut title = bbs.gamer.com.tw host = bbs.gamer.com.tw
重新啟動服務
# /etc/init.d/smokeping restart
Cacti is a complete network graphing solution designed to harness the power of RRDTool's data storage and graphing functionality.