MIB文件编写问题

时间:2012-10-18 13:11:42

标签: snmp net-snmp mib

IONLINE-MIB DEFINITIONS ::= BEGIN

IMPORTS
    IpAddress,
    MODULE-IDENTITY,
    OBJECT-TYPE,
    NOTIFICATION-TYPE,
    snmpModules,
    OBJECT-IDENTITY,
    enterprises,
    Counter32,
    Integer32
        FROM SNMPv2-SMI
    DisplayString,
    TEXTUAL-CONVENTION,
    TruthValue,
    DateAndTime
        FROM SNMPv2-TC;


elite   MODULE-IDENTITY
      LAST-UPDATED  "201208220000Z"
      ORGANIZATION  "E Technologies"
      CONTACT-INFO
                        "
                        Postal: XXX
                        E-mail: i@o.c
                        "
      DESCRIPTION
                        "
                        This MIB module defines MIB objects which provide
                            mechanisms to remotely configure the parameters used
                            by 24Online Agent for the generation of SNMP messages.
                        "
    ::= { enterprises 21068 }


ionline OBJECT-IDENTITY
    STATUS          current
    DESCRIPTION ""
    ::= { elite 3 }

-- Enumerations used in 24online system


-- 24online
onSystem        OBJECT IDENTIFIER ::= { ionline 1 }

-- 24online.system
sysStatus       OBJECT IDENTIFIER ::= { onSystem 1 }

-- onSystem.sysInstall

poolStatus      OBJECT IDENTIFIER ::= { sysStatus 3 }

poolUsage  OBJECT-TYPE
    SYNTAX          Counter32
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION     "% pool usage"
    ::= { poolStatus 1 }
END

以上是标量对象的示例MIB文件。 poolUsage是单个OID的存储...我想将它添加为一个表,我可以分配像poolUsage.1,poolUsage.2等值。 我想将此标量转换为“表格”格式... 我该怎么办?请帮帮我。

2 个答案:

答案 0 :(得分:2)

this tutorial。我认为这正是你所需要的。

其基本内容转载如下:

batteryTable OBJECT-TYPE
    SYNTAX     SEQUENCE OF BatteryEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
        "The (conceptual) table of batteries contained by the
        module."
    ::= { monitor 1 }

batteryEntry OBJECT-TYPE
    SYNTAX     BatteryEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
        "A (conceptual) entry for one battery contained by
        the module.  The batteryIndex in the index represents
        the entry in the batteryTable that corresponds to the
        batteryEntry.

        As an example of how objects in this table are named,
        an instance of the batteryVoltage object might be
        named batteryVoltage.3"
    INDEX { batteryIndex }
    ::= { batteryTable 1 }

batteryIndex OBJECT-TYPE
    SYNTAX      DeviceIndex
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
            "A unique value, greater than zero, for each battery. 
            It is recommended that values are assigned contiguously
            starting from 1."
    ::= { batteryEntry 1 }

batteryVoltage    OBJECT-TYPE 
   SYNTAX Integer32 
   ACCESS read-only 
   STATUS current 
   DESCRIPTION 
      "Voltage A/D value" 
   ::= { batteryEntry 2 }

答案 1 :(得分:0)

如果你需要编写任何复杂的东西,我强烈建议你买一本关于MIB的书。这是一种“有趣”的语言,如果你在写东西时做得对,那就更好了......

但是,你至少应该阅读描述语言的RFC2578(然而,正式比教程更正式)。您还可以查看一个示例,例如RFC2863: the IF-MIB,其中包含一个可以复制的结构的简单表(ifTable)。