SNMP/SMI研究总结
近期为了完成模型适配任务而进行
最近由于需要完成一个模型适配的内容而持续关注
SMIv2包括:
RFC 2578 SMIv2 对语法的定义:数据结构必须满足以下任一条件:基类型、BITS 构造器??(这一部分尚不完全理解,请参考相关资料)或文本约定。需要注意的是,在概念表中还可能包含 SEQUENCE OF 和 SEQUENCE 类型(参见第 7.1.12 节)。基类型是指根据 ObjectSyntax 的 CHOICE 定义的一类类型。文本约定是一种新的定义类型,并以其所属基类型的子类型形式被定义 [RFC 2579]。
During the design phase of a MIB module, it is commonly employed to create new types that are analogous to those originally defined within the SMI framework. When comparing these newly created types with those established in SM Iv2, each variant features a distinct name while maintaining similarities in syntax but enhancing semantic clarity. These specialized constructs are referred to as textual conventions and serve primarily for ease of human comprehension. The objective of this document is therefore to establish an initial set of textual conventions that can be utilized by all MIB modules.
The RFC2580 SMIv2 Conformance Statements for SMIv outlines(The document's primary objective is to establish a standardized framework for assessing conformance to these specifications.)
表格 1 SMI发展概览(SMI第一版)
| SMI首次定义 | 1988.8 | 1065 |
|---|---|---|
| SMI修订 | 1990.5 | 1155 |
| 精确MIB格式的定义 | 1991.3 | 1212 |
| 陷阱的定义 | 1991.3 | 1215 |
表格 2 MIB发展概览
| MIB-1首次定义 | 1988.8 | 1066 |
|---|---|---|
| MIB-1修改 | 1990.5 | 1156 |
| MIB-2引入 | 1990.5 | 1158 |
| MIB-2修改 | 1991.3 | 1213 |
表格 3 SNMPv2 RFC发展历程(SMIv2)
| Obsolete | Obsolete | Current | |
|---|---|---|---|
| SNMPv2 SMI | 1442 | 1902(1996) | 2578(1999)SMIv2 |
| SNMPv2 TC | 1443 | 1903 | 2579 SMIv2-TC |
| SNMPv2 CONF | 1444 | 1904 | 2580 SMIv2-CONF |
SNMPv2(狭义)与SMIv2的联系,独立
MIB中的类型和宏:
| RFC2578(Obsoletes: 1902 D. Perkin) | 数据类型 | -- 3 built-in ASN.1 types: INTEGER, OCTET STRING, OBJECT IDENTIFIER -- 8 application-defined types: Integer32, IpAddress, Counter32, -- Gauge32, Unsigned32, TimeTicks, Opaque, and Counter64 |
|---|---|---|
| 宏 | MODULE-IDENTITY MACROOBJECT-IDENTITY MACRO OBJECT-TYPE MACRO NOTIFICATION-TYPE MACRO | |
| RFC2579(Obsoletes: 1903) | 数据类型 | DisplayString(totalSNMPp86) PhysAddress MacAddress TruthValue TestAndIncr AutonomousType InstancePointer VariablePointer RowStatus RowPointe TimeStamp TimeInterval DateAndTime StorageType TDomain TAddress |
| 宏 | TEXTUAL-CONVENTION | |
| RFC2580(Obsoletes: 1904) | 数据类型 | |
| 宏 | OBJECT-GROUP NOTIFICATION-GROUP MODULE-COMPLIANCE ANENT-CAPABILITIE | |
| ??IMPORTS ObjectName, NotificationName, ObjectSyntax FROM SNMPv2-SMI |
表格 4 MAX-ACCESS字段取值说明
| not-accessible | |
|---|---|
| accessible-for notify | |
| read-only | |
| read-write | |
| read-creat |
表格 5 STATUS字段取值说明
| current | |
|---|---|
| deprecated | |
| obsolete |
Reserved Keywords(2578)
The following are reserved keywords which must not be used as
descriptors or module names:
ABSENT ACCESS AGENT-CAPABILITIES ANY APPLICATION AUGMENTS BEGIN
BIT BITS BOOLEAN BY CHOICE COMPONENT COMPONENTS CONTACT-INFO
CREATION-REQUIRES Counter32 Counter64 DEFAULT DEFINED
DEFINITIONS DEFVAL DESCRIPTION DISPLAY-HINT END ENUMERATED
ENTERPRISE EXPLICIT EXPORTS EXTERNAL FALSE FROM GROUP Gauge32
IDENTIFIER IMPLICIT IMPLIED IMPORTS INCLUDES INDEX INTEGER
Integer32 IpAddress LAST-UPDATED MANDATORY-GROUPS MAX MAX-ACCESS
MIN MIN-ACCESS MINUS-INFINITY MODULE MODULE-COMPLIANCE MODULE-
IDENTITY NOTIFICATION-GROUP NOTIFICATION-TYPE NOTIFICATIONS NULL
OBJECT OBJECT-GROUP OBJECT-IDENTITY OBJECT-TYPE OBJECTS OCTET OF
OPTIONAL ORGANIZATION Opaque PLUS-INFINITY PRESENT PRIVATE
PRODUCT-RELEASE REAL REFERENCE REVISION SEQUENCE SET SIZE STATUS
STRING SUPPORTS SYNTAX TAGS TEXTUAL-CONVENTION TRAP-TYPE TRUE
TimeTicks UNITS UNIVERSAL Unsigned32 VARIABLES VARIATION WITH
WRITE-SYNTAX
OBJECT IDENTIFIER解析:
mib-2 OBJECT IDENTIFIER ::= { mgmt 1 } -- mgmtOID=1.3.6.1.2
system OBJECT IDENTIFIER ::= { mib-2 1 } --表示方法1
system OBJECT IDENTIFIER ::= { mgmt mib-2(1) system(1) } --表示方法2
system OBJECT IDENTIFIER ::= { mgmt mib-2(1) 1 } --表示方法3
system OBJECT IDENTIFIER ::= 1.3.6.1.2.1.1 --表示方法4
每个类都有自己的OID?(只有TC宏没有。)
Syntax ::= -- Must be one of the following:
-- a base type (or its refinement),
-- a textual convention (or its refinement), or
-- a BITS pseudo-type??
