Mrtg安裝心得與須注意的地方
小弟我昨天凌晨1點多,心血來潮的想安裝mrtg結果…架設失敗…>.<
今天氣到…請假一天在家裡繼續努力…XD~~~結果成功了~
不自量力的寫這篇sop~希望對大家有所幫助才是~
結論是:Mrtg結果失敗,最大的原因是snmpd.conf這個檔沒設好~
-------------------------------
環境:RedHat 8.0 + Mrtg
-------------------------------
----------------------------------------------
設定snmp.conf /etc/snmp/snmpd.conf
-----------------------------------------------
----///先把以下的mark起來-把預設disable//----
# sec.name source community
#com2sec notConfigUser default public
#om2sec mynetwork 192.168.0.0/24 public
# Second, map the security name into a group name:
# groupName securityModel securityName
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
# name incl/excl subtree mask(optional)
#view systemview included .1.3.6.1.2.1.1
#view systemview included .1.3.6.1.2.1.25.1.1
# group context sec.model sec.level prefix read write noti f
#access notConfigGroup "" any noauth exact systemview none none
----///修改下列-把設定enable起來///----
## sec.name source community
com2sec local localhost public
com2sec lan 192.168.0.0/24 public
## group.name sec.model sec.name
group MyRWGroup v1 local
group MyROGroup v1 lan
## incl/excl subtree mask
view all included .1 80
## context sec.model sec.level prefix read write notif
access MyROGroup "" any noauth prefix all none none
access MyRWGroup "" any noauth prefix all all all
-----------------------------------------------------------------------------------------------------------------------------------------------
***************!切記!一定要把預設的設定mark起來,不然會出現以下的訊息…*************************
-----------------------------------------------------------------------------------------------------------------------------------------------
[root@pure bin]# ./cfgmaker --output=/var/www/html/mrtg/mrtg.cfg \
> public@127.0.0.1
--base: Get Device Info on public@127.0.0.1:
--base: Vendor Id:
--base: Populating confcache
--snpo: Skipping ifName scanning because public@127.0.0.1: does not seem to support it
--base: Get Interface Info
--base: Walking ifIndex
--base: Walking ifType
--base: Walking ifAdminStatus
--base: Walking ifOperStatus
--base: Walking ifSpeed
--base: Writing /var/www/html/mrtg/mrtg.cfg
*********就是下面這一行….snmp好像會先執行預設的conf檔內容,而skip在後面的設定….*********
--snpo: Skipping ifName scanning because public@127.0.0.1: does not seem to support it
------------------
2.啟動snmp
-------------
service snmpd restart
-----------------------
3.執行Cfgmaker
-----------------------
[root@mail root]# cfgmaker --global 'WorkDir: /var/www/html/mrtg' \
> --global 'Options[_]: bits,growright' \
> --global 'Language: big5' \
> --output /etc/mrtg/mrtg.cfg \
> public@192.168.0.20:
正常的話會出現以下的訊息
--base: Get Device Info on public@192.168.0.20:
--base: Vendor Id:
--base: Populating confcache
--snpo: confcache public@192.168.0.20: Descr lo --> 1
--snpo: confcache public@192.168.0.20: Descr eth0 --> 2
--snpo: confcache public@192.168.0.20: Ip 127.0.0.1 --> 1
--snpo: confcache public@192.168.0.20: Ip 192.168.0.20 --> 2
--snpo: confcache public@192.168.0.20: Type 24 --> 1
--snpo: confcache public@192.168.0.20: Type 6 --> 2
--snpo: confcache public@192.168.0.20: Eth --> 1
--snpo: confcache public@192.168.0.20: Eth 00-03-6d-30-2a-53 --> 2
--base: Get Interface Info
--base: Walking ifIndex
--base: Walking ifType
---------------
4.執行mrtg
----------------
連續三次直到沒有warnning的訊息出現….
mrtg /etc/mrtg/mrtg.cfg
-------------------------------------------
5.產生流量分析網頁index.html
----------------------------
indexmaker --columns=1 \
--output=/var/www/html/mrtg/index.html \
--title='Traffic Info' \
/etc/mrtg/mrtg.cfg
-------------------------------------
6.觀看mrtg 流量分析表囉…
-------------------------------------
http://your.domain.name/mrtg/index.html心得….
1.請不要照抄sop的每一個字元….
2.多利用搜尋的功能….
參考文章:
http://www.study-area.org/tips/mrtg.htm netman大大的文章
http://aerosol.ev.ncku.edu.tw/~vbird/safe/04mrtg.html 鳥大的文章