SNMP解释RMON2-MIB文件的正确方法是什么?

时间:2014-09-16 08:51:33

标签: snmp sharp-snmp

我正在使用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 interpreter’s source

RMON2-MIB

RFC 2579

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

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

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

1 个答案:

答案 0 :(得分:2)

首先,#SNMP的开源MIB解析器SharpSnmpLib.Mib是错误的和过时的,因为#SNMP Pro有一个新的SharpSnmpPro.Mib

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

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

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