apt-get install snmp snmpd
apt-get install mrtg
[snmpd.conf]
先備份
# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
編輯 snmpd.conf
# echo 'rocommunity public' > /etc/snmp/snmpd.conf
很多人mrtg裝不起來,大多是因為snmpd.conf弄不好,不過我發現到一個可以偷吃步的方法!!
打上這一行(注意空格),就全部ok嘍,夠輕鬆愉快吧!!
重跑snmp
# /etc/init.d/snmpd restart
測試一下snmp
snmpwalk localhost -c public -v 1
跑出一堆訊息就成功嘍!!
...
...
HOST-RESOURCES-MIB::hrSWRunPerfMem.21022 = INTEGER: 1304 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.21023 = INTEGER: 1752 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.26812 = INTEGER: 14788 KBytes
IPV6-MIB::ipv6Forwarding.0 = INTEGER: notForwarding(2)
IPV6-MIB::ipv6DefaultHopLimit.0 = INTEGER: 0
----------------------------------------------------------------------
snmp搞好了,就成功一半嘍,其他的就沒啥大礙了!
[安裝mrtg]
apt-get install mrtg
會詢問妳
Make /etc/mrtg.conf owned by and readable only by the MRTG user?
選擇Yes
----------------------------------------------------------------------
[產生mrtg.cfg]
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
整行複製吧,不斷行!!
----------------------------------------------------------------------
執行mrtg
#mrtg /etc/mrtg.cfg
執行3次,無錯誤訊息即可
----------------------------------------------------------------------
[產生流量分析網頁index.html]
indexmaker --columns=1 \
--output=/var/www/mrtg/index.html \
--title='Traffic Info' \
/etc/mrtg/mrtg.cfg
或是...
indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
以上都一樣是產生 index.html
----------------------------------------------------------------------
[觀看mrtg 流量分析表囉]
http://your.domain.name/mrtg/index.html
以上這樣就會有基本的 eth0 的流量分析了
沒有留言:
張貼留言