4

我正在使用sharpsnmplib 开源库来编译MIB 文件并在我的自定义snmp 浏览器中使用它们。问题是Sharpsnmplib 无法编译RMON2-MIB 文件。使用它的后续库也无法编译。事实证明,(第一个)问题与文本(RMON2-MIB.txt)有关:

LastCreateTime ::= TEXTUAL-CONVENTION
    STATUS current
    DESCRIPTION
        "This TC describes an object that stores the last time its
        entry was created.

        This can be used for polling applications to determine that an
        entry has been deleted and re-created between polls, causing
        an otherwise undetectable discontinuity in the data."
    SYNTAX TimeStamp

Sharpsnmplib 的文本约定解释器包含以下文本:

/* 
         * RFC2579 definition:
         *       Syntax ::=   -- Must be one of the following:
         *                    -- a base type (or its refinement), or
         *                    -- a BITS pseudo-type
         *               type
         *             | "BITS" "{" NamedBits "}"
         *
         * From section 3.5:
         *      The data structure must be one of the alternatives defined
         *      in the ObjectSyntax CHOICE or the BITS construct.  Note
         *      that this means that the SYNTAX clause of a Textual
         *      Convention can not refer to a previously defined Textual
         *      Convention.
         …

Sharpsnmplib 解释器的源码

RMON2-MIB

RFC 2579

有趣的是,TimeStamp 是 SNMPv2-TC 中定义的文本约定。RMON2-MIB 定义了自己的使用时间戳的文本约定。RMON2-MIB 中还有其他几个文本约定,它们引用了其他 MIB 文件中的文本约定。

因此,如果我做对了,RMON2-MIB 就违反了 RFC2579。但是如果 RMON2-MIB 是主动使用的 MIB 文件,这没有任何意义。

我错过了什么?应该如何正确解释 RMON2-MIB?

4

1 回答 1

2

首先,#SNMP 的开源 MIB 解析器 SharpSnmpLib.Mib 有缺陷且已过时,因为 #SNMP Pro 有一个新的SharpSnmpPro.Mib

您找到的代码甚至更旧(我的手工版本),所以我没想到它能够解析困难的 MIB 文档。

其次,RMON2-MIB 是一个非常复杂的 MIB,因为它既依赖于 SMIv2 核心 MIB,也依赖于几个 SMIv1。这要求您正确定位所有依赖项(使用正确的副本,而不是从 Internet 下载损坏的副本)。

第三,RFC 2579 和 RFC 4502 (RMON2-MIB) 之间没有冲突。RMON2-MIB 定义了它自己的使用 TimStamp 的文本约定,这没有什么特别或错误的。

于 2014-09-20T07:10:04.117 回答