1

我已经申请PEN(Private Enterprise Number)并得到了它。笔是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    
        "myMail@comName.com"
    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

对此有什么建议吗?所有其他snmpget查询system都运行良好。任何帮助将不胜感激。谢谢你

4

0 回答 0