如何阅读Mib文件

RFC1213-MIB DEFINITIONS ::= BEGIN *定义了MIB文件的名称,RFC1213就是MIB2 *

IMPORTS *从其他MIB中输入文件类型或者是OID *
mgmt, NetworkAddress, IpAddress, Counter, Gauge,
TimeTicks
FROM RFC1155-SMI *从RFC1155(SMIv1)中输入mgmt,networkaddress等内容*
OBJECT-TYPE
FROM RFC 1212; *从RFC1212中输入对象类型 *

mib-2 OBJECT IDENTIFIER ::= { mgmt 1 } *定义mib2为mgmt叶子节点编号为1及1.3.6.1.2.1Eric note,这里可能就是最上面的一个节点*

-- groups in MIB-II

system OBJECT IDENTIFIER ::= { mib-2 1 } *定义MIB2的子树 system=1.3.6.1.2.1.1*
interfaces OBJECT IDENTIFIER ::= { mib-2 2 } *定义MIB2的子树 int=1.3.6.1.2.1.2*
at OBJECT IDENTIFIER ::= { mib-2 3 }
ip OBJECT IDENTIFIER ::= { mib-2 4 }
icmp OBJECT IDENTIFIER ::= { mib-2 5 }
tcp OBJECT IDENTIFIER ::= { mib-2 6 }
udp OBJECT IDENTIFIER ::= { mib-2 7 }
egp OBJECT IDENTIFIER ::= { mib-2 8 }
transmission OBJECT IDENTIFIER ::= { mib-2 10 }
snmp OBJECT IDENTIFIER ::= { mib-2 11 }

-- the Interfaces table

-- The Interfaces table contains information on the entity's
-- interfaces. Each interface is thought of as being
-- attached to a 'subnetwork.' Note that this term should
-- not be confused with 'subnet,' which refers to an
-- addressing-partitioning scheme used in the Internet
-- suite of protocols.

ifTable OBJECT-TYPE *定义MIB2子集ifTable,首字母小写由ASN.1定义*
SYNTAX SEQUENCE OF IfEntry *定义数据类型为SEQUENCE OF IfEntry*
ACCESS not-accessible *定义存取方式为不能通过任何方式请求agent的变量值*
STATUS mandatory *定义状态为强制,agent必须按照MIB2规定的执行*
DESCRIPTION *定义此对象的说明*
"A list of interface entries. The number of entries is
given by the value of ifNumber."
::= { interfaces 2 } *OID=1.3.6.1.2.1.2.2*

ifEntry OBJECT-TYPE
SYNTAX IfEntry *数据类型在后面的表格中对应*
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"An interface entry containing objects at the subnetwork
layer and below for a particular interface."
INDEX { ifIndex } *对应到后面的定义,如果有6个端口,IfEntry表中有6个表项*
::= { ifTable 1 } *OID=1.3.6.1.2.1.2.2.1*

IfEntry ::= *定义一张的表,注意首字母大写,区别于对象的定义*
SEQUENCE {
ifIndex
INTEGER,
ifDescr
DisplayString,
ifType
INTEGER,
ifMtu
INTEGER,
ifSpeed
Gauge,
ifPhysAddress
PhysAddress,
ifAdminStatus
INTEGER,
ifOperStatus
INTEGER,
ifLastChange
TimeTicks,
ifInOctets
Counter,
ifInUcastPkts
Counter,
ifInNUcastPkts
Counter,
ifInDiscards
Counter,
ifInErrors
Counter,
ifInUnknownProtos
Counter,
ifOutOctets
Counter,
ifOutUcastPkts
Counter,
ifOutNUcastPkts
Counter,
ifOutDiscards
Counter,
ifOutErrors
Counter,
ifOutQLen
Gauge,
ifSpecific
OBJECT IDENTIFIER
}

ifIndex OBJECT-TYPE
SYNTAX INTEGER *定义数据类型为整数*
ACCESS read-only *定义存取方式为只读*
STATUS mandatory
DESCRIPTION
"A unique value for each interface. Its value ranges
between 1 and the value of ifNumber. The value for
each interface must remain constant at least from one
reinitialization of the entity's network management
system to the next reinitialization."

::= { ifEntry 1 }

ifDescr OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
ACCESS read-only
STATUS mandatory
DESCRIPTION
"A textual string containing information about the
interface. This string should include the name of
the manufacturer, the product name, and the version
of the hardware interface."
::= { ifEntry 2 }

END

你可能感兴趣的:(mib)