我正在从MIB编写SNMP管理器和模拟的SNMP代理(以测试管理器)。我有一个类似于下面的表格,管理员应该能够添加/删除行。使用RowStatus的常规方式是什么?首先设置RowStatus吗? PDU中可以包含其他OID吗?

我最初的用例是表在启动时为空。因此,如果我发送SET PDU像这样:

createStuffEntry.1.1.1 = 1
createStuffEntry.2.1.1 = 1
createStuffEntry.3.1.1 = 99
createStuffEntry.4.1.1 = "Dustbunnies"
createStuffEntry.5.1.1 = 5


这对下面的定义有用吗?如果省略cRowStatus会发生什么?

createStuffTable OBJECT-TYPE
    SYNTAX  SEQUENCE OF CreateStuffEntry
    ACCESS  not-accessible
    STATUS  mandatory
    DESCRIPTION
            "A table for creating stuff."
    ::= { parentGroup 1 }

createStuffEntry OBJECT-TYPE
    SYNTAX  CreateStuffEntry
    ACCESS  not-accessible
    STATUS  mandatory
    DESCRIPTION
            "An entry for building a stuff to create."
    INDEX   { cPlanID,  cID }
    ::= { createStuffTable 1 }

CreateStuffEntry ::=
    SEQUENCE {
        cPlanID
            INTEGER,
        cID
            INTEGER,
        cTemplateID
            INTEGER,
        cStuffName
            DisplayString,
        cRowStatus
            RowStatus
    }

cPlanID OBJECT-TYPE
    SYNTAX  INTEGER
    ACCESS  read-write
    STATUS  mandatory
    DESCRIPTION
            "The plan ID (cpPlanID)"
    ::= { createStuffEntry 1 }

cID OBJECT-TYPE
    SYNTAX  INTEGER
    ACCESS  read-write
    STATUS  mandatory
    DESCRIPTION
            "The table entry index."
    ::= { createStuffEntry 2 }

cTemplateID OBJECT-TYPE
    SYNTAX  INTEGER
    ACCESS  read-write
    STATUS  mandatory
    DESCRIPTION
            "The ID of the stuff template to create this stuff from."
    ::= { createStuffEntry 3 }

cStuffName OBJECT-TYPE
    SYNTAX  DisplayString
    ACCESS  read-write
    STATUS  mandatory
    DESCRIPTION
            "The stuff name."
    ::= { createStuffEntry 4 }


 cRowStatus OBJECT-TYPE
    SYNTAX  RowStatus
    ACCESS  read-write
    STATUS  current
    DESCRIPTION
       "This OID uses six main statuses:
        active(1)         is in use and available in stuffTable
        notinService(2)   it is present but not yet created
        notReady(3)       it is present but missing info
        createAndGo(4)    create stuff in stuffTable.  Row will be
                          added to this table if necessary.
        createAndWait(5)  add stuff row to this table
        destroy(6)        will remove the stuff row

        This OID is used to add/remove rows for stuff creation.
        It can also be used to determine if a stuff has been
        created successfully."
    ::= { createStuffEntry 5 }


请注意,这是使用RowStatus作为定义类型的SMI v1 MIB,与here所述类似。因此,暗含了“读取创建”,而不是在此说明。

最佳答案

实际上,RowStatus文本约定为代理实现方式提供了很大的余地。因此,管理者必须支持这两种方式,代理必须仅支持一种方式(但可以支持两种方式):


连续PDU:

将行状态变量设置为“ createAndWait”
设置要设置的所有列(在一个或多个PDU中)
将行状态变量设置为“活动”

将行状态变量设置为“ createAndGo”,并将所有需要设置的变量包括进所有PDU中


不幸的是,经理需要有才智,并且知道如何与支持一个或另一个的代理进行交谈。人们普遍认为,经理人比细微的代理人更大,并且有更多的问题代码空间。不过,许多小型设备仅支持上述#2。

07-24 09:38