net-snmp 的 OID 有什么问题?

net-snmp 的 OID 有什么问题?

我已经请求PEN(Private Enterprise Number)并得到了它。PEN 为 50743。我有一个非常简单的,MIB看起来像这样:

SAMPLE-SNMP-MIB DEFINITIONS ::= BEGIN     

IMPORTS    
    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
    Integer32, enterprises  FROM SNMPv2-SMI
;

sampleSnmp    MODULE-IDENTITY    
    LAST-UPDATED "201709120200Z"    
    ORGANIZATION "Company Name"    
    CONTACT-INFO    
        "[email protected]"
    DESCRIPTION    
        "A test MIB"    
    REVISION    "201709220200Z"    
    DESCRIPTION    
        "initial Draft"    
    ::= { enterprises 50743 }   


sampleSnmpScalar  OBJECT IDENTIFIER ::= { sampleSnmp 1 }

sampleVar OBJECT-TYPE    
    SYNTAX Integer32    
    MAX-ACCESS  read-write    
    STATUS  current    
    DESCRIPTION    
        "A simple test object"    
    ::= { sampleSnmpScalar 1}

END

经过编译(sampleVar.c sampleVar.h)和配置后,当我执行此操作时snmpwalk,我得到了如下结果:

root@ashish:~# snmpwalk -v 2c -c ncs 192.168.5.13 SAMPLE-SNMP-MIB::sampleSnmp
SAMPLE-SNMP-MIB::sampleSnmpScalar.0 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.2.1.2.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = STRING: "/bin/echo"
SAMPLE-SNMP-MIB::sampleSnmp.2.1.3.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = ""
SAMPLE-SNMP-MIB::sampleSnmp.2.1.4.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = ""
SAMPLE-SNMP-MIB::sampleSnmp.2.1.5.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 5
SAMPLE-SNMP-MIB::sampleSnmp.2.1.6.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.2.1.7.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.2.1.20.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 4
SAMPLE-SNMP-MIB::sampleSnmp.2.1.21.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.3.1.1.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = ""
SAMPLE-SNMP-MIB::sampleSnmp.3.1.2.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = ""
SAMPLE-SNMP-MIB::sampleSnmp.3.1.3.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.3.1.4.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 0
SAMPLE-SNMP-MIB::sampleSnmp.4.1.2.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51.1 = ""

OID 有什么问题?我的意思是,要使用snmpget,我必须进行如下查询:

snmpget ... sampleSnmp.2.1.5.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51

更新: snmptranslate工作正常:

root@ashish:~# snmptranslate -IR -On SAMPLE-SNMP-MIB::sampleSnmp SAMPLE-SNMP-MIB::sampleSnmpScalar SAMPLE-SNMP-MIB::sampleVar
.1.3.6.1.4.1.50743
.1.3.6.1.4.1.50743.1
.1.3.6.1.4.1.50743.1.1

对此有什么建议吗?任何帮助都将不胜感激。谢谢

相关内容