iT邦幫忙

0

請教 SNMP + MRTG 設定問題

yaojie 2010-02-15 20:12:5619842 瀏覽
  • 分享至 

  • xImage

各位好,想請教一下SNMP 與 MRTG的設定問題..
我的OS是CENTOS 5.3裝在VM上
首先是SNMPD.CONF這個檔案,查網路上與書上設定方式都不太相同..像底下這幾個設定值的用意是為何
該如何設定

sec.name source community

com2sec notConfigUser default public

groupName securityModel securityName

group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser

Make at least snmpwalk -v 1 localhost -c public system fast again.

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 notif

access notConfigGroup "" any noauth exact systemview none none

我照書上的只加了 view systemview included .1.3.6.1.2.1.2
存檔,重啟SNMPD 然後使用
cfgmaker public@172.20.0.66 > /etc/mrtg/mrtg.cfg
出現如下詢息
SNMP Error:
no response received
SNMPv1_Session (remote host: "172.20.0.66" [172.20.0.66].161)
community: "public"
request ID: 993835520
PDU bufsize: 8000 bytes
timeout: 2s
retries: 5
backoff: 1)
at /usr/bin/../lib/mrtg2/SNMP_util.pm line 627
SNMPWALK Problem for 1.3.6.1.2.1.1 on public@172.20.0.66::::::v4only
at /usr/bin/cfgmaker line 918
WARNING: Skipping public@172.20.0.66: as no info could be retrieved
然後我打開mrtg.cfg裡面只有如下幾行,沒看到其它的WorkDir..Target ...SetEnv..等一些參數

Created by

/usr/bin/cfgmaker public@172.20.0.66

Global Config Options

for UNIX

WorkDir: /home/http/mrtg

or for NT

WorkDir: c:\mrtgdata

Global Defaults

to get bits instead of bytes and graphs growing to the right

Options[_]: growright, bits

EnableIPv6: no
###################################

System:

Description:

Contact:

Location:

#############################
所以我下了env LANG=C mrtg /etc/mrtg/mrtg.cfg 並不會產生相關報表檔...
試了一天了..還是試不出來...還請有經驗的前輩們指點一下..

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

6
hon0612
iT邦新手 4 級 ‧ 2010-02-16 11:44:12
最佳解答

yaojie提到:
.1

只要設view systemview included .1.3.6.1.2.1這個參數,所有oid的東西就出來了
如果你只想用filter oid的話,最好吧先實作snmpwalk這個指令吧
man snmpwalk吧
基本指令

sec.name source community

com2sec notConfigUser default public
snmpwalk 127.0.0.1 -v 1 -c "public"
就會出現很多有關硬體的oid資訊
如果你要反解的話
snmpwalk 127.0.0.1 -v 1 -On -c "public"
如果你要找cpu oid
snmpwalk 127.0.0.1 -v 1 -On -c "public" Cpu
不知道這個可以不可以幫到你

看更多先前的回應...收起先前的回應...
yaojie iT邦新手 5 級 ‧ 2010-02-16 16:38:04 檢舉

感謝你的回覆..
下完指令後所得的項目有這些..但可以請教如何分析出它的OID嗎
SNMPv2-MIB::sysDescr.0 = STRING: Linux demo.sytes.net 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (16982) 0:02:49.82
SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)

yaojie iT邦新手 5 級 ‧ 2010-02-16 16:38:37 檢舉

SNMPv2-MIB::sysName.0 = STRING: jnet2.sytes.net
SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (11) 0:00:00.11
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.2 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.3 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.4 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.5 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.6 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.7 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.8 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.3 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for managing UDP implementations

yaojie iT邦新手 5 級 ‧ 2010-02-16 16:38:45 檢舉

SNMPv2-MIB::sysORDescr.5 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.6 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.7 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.8 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (10) 0:00:00.10
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (10) 0:00:00.10
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (10) 0:00:00.10
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (10) 0:00:00.10
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (10) 0:00:00.10
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (11) 0:00:00.11
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (11) 0:00:00.11
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (11) 0:00:00.11
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (976889) 2:42:48.89
End of MIB

yaojie iT邦新手 5 級 ‧ 2010-02-17 14:37:17 檢舉

我下了 snmpwalk 127.0.0.1 -v 1 -On -c "public"
得到如下
.1.3.6.1.2.1.1.1.0 = STRING: Linux jnet2.sytes.net 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.8072.3.2.10
.1.3.6.1.2.1.1.3.0 = Timeticks: (4292607575) 496 days, 19:54:35.75
.1.3.6.1.2.1.1.4.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
.1.3.6.1.2.1.1.5.0 = STRING: jnet2.sytes.net
.1.3.6.1.2.1.1.6.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)
.1.3.6.1.2.1.1.8.0 = Timeticks: (16) 0:00:00.16
.1.3.6.1.2.1.1.9.1.2.1 = OID: .1.3.6.1.6.3.1
.1.3.6.1.2.1.1.9.1.2.2 = OID: .1.3.6.1.2.1.49
.1.3.6.1.2.1.1.9.1.2.3 = OID: .1.3.6.1.2.1.4
.1.3.6.1.2.1.1.9.1.2.4 = OID: .1.3.6.1.2.1.50
.1.3.6.1.2.1.1.9.1.2.5 = OID: .1.3.6.1.6.3.16.2.2.1
.1.3.6.1.2.1.1.9.1.2.6 = OID: .1.3.6.1.6.3.10.3.1.1

yaojie iT邦新手 5 級 ‧ 2010-02-17 14:37:45 檢舉

.1.3.6.1.2.1.1.9.1.2.7 = OID: .1.3.6.1.6.3.11.3.1.1
.1.3.6.1.2.1.1.9.1.2.8 = OID: .1.3.6.1.6.3.15.2.1.1
.1.3.6.1.2.1.1.9.1.3.1 = STRING: The MIB module for SNMPv2 entities
.1.3.6.1.2.1.1.9.1.3.2 = STRING: The MIB module for managing TCP implementations
.1.3.6.1.2.1.1.9.1.3.3 = STRING: The MIB module for managing IP and ICMP implementations
.1.3.6.1.2.1.1.9.1.3.4 = STRING: The MIB module for managing UDP implementations
.1.3.6.1.2.1.1.9.1.3.5 = STRING: View-based Access Control Model for SNMP.
.1.3.6.1.2.1.1.9.1.3.6 = STRING: The SNMP Management Architecture MIB.
.1.3.6.1.2.1.1.9.1.3.7 = STRING: The MIB for Message Processing and Dispatching.
.1.3.6.1.2.1.1.9.1.3.8 = STRING: The management information definitions for the SNMP User-based Security Model.

yaojie iT邦新手 5 級 ‧ 2010-02-17 14:39:01 檢舉

.1.3.6.1.2.1.1.9.1.4.1 = Timeticks: (14) 0:00:00.14
.1.3.6.1.2.1.1.9.1.4.2 = Timeticks: (14) 0:00:00.14
.1.3.6.1.2.1.1.9.1.4.3 = Timeticks: (14) 0:00:00.14
.1.3.6.1.2.1.1.9.1.4.4 = Timeticks: (14) 0:00:00.14
.1.3.6.1.2.1.1.9.1.4.5 = Timeticks: (14) 0:00:00.14
.1.3.6.1.2.1.1.9.1.4.6 = Timeticks: (16) 0:00:00.16
.1.3.6.1.2.1.1.9.1.4.7 = Timeticks: (16) 0:00:00.16
.1.3.6.1.2.1.1.9.1.4.8 = Timeticks: (16) 0:00:00.16
.1.3.6.1.2.1.25.1.1.0 = Timeticks: (418453) 1:09:44.53
End of MIB
我要怎麼知這些數字的用途是在那方面

我要發表回答

立即登入回答