This topic describes the formats of valid MIB objects.
The following sections describe the valid SNMP MIB object formats.
A v2 TEXTUAL-CONVENTION (TC) has the following syntax, where the object name is followed by the ::= entry and then TEXTUAL-CONVENTION. Several sections follow and are appended with the SYNTAX definition.
DisplayString ::= TEXTUAL-CONVENTION
DISPLAY-HINT "255a"
STATUS current
DESCRIPTION "Represents textual information taken from the NVT SCII character set, as defined in pages 4, 10-11 of RFC 854. To summarize RFC 854, the NVT ASCII repertoire specifies: - the use of character codes 0-127 (decimal) - the graphics characters (32-126) are interpreted as US ASCII - NUL, LF, CR,BEL, BS, HT, VT and FF have the special meanings specified in RFC 854 - the other 25 codes have no standard interpretation - the sequence 'CR LF' means newline - the sequence 'CR NUL' means carriage-return - an 'LF' not preceded by a 'CR' means moving to the same column on the next line. - the sequence 'CR x' for any x other than LF or NUL is illegal. (Note that this also means that a string may end with either 'CR LF' or 'CR NUL', but notwith CR.) Any object defined using this syntax may not exceed 255 characters in length."
SYNTAX OCTET STRING (SIZE (0..255))
A v1 TC consists of the object name followed by the ::= entry, and is then appended with a valid SYNTAX definition. For example:
DisplayString ::= OCTET STRING
Both these objects exist outside the MIB tree and therefore are not objects in the MIB. They represent a format for which a syntax can be defined. They have no OID. You can view them in the MIB Modules view, in a separate filter, by clicking the View drop-down list, and selecting Textual-Conventions.
The TRAP-TYPE object is valid for v1 MIBs. These objects were not originally defined to fit cleanly into the MIB tree. They do not have an OID but instead have an enterprise ID and a trap number, for example:
newRoot TRAP-TYPE
ENTERPRISE dot1dBridge
DESCRIPTION "The newRoot trap indicates that the sending agent has become the new root
of the Spanning Tree; the trap is sent by a bridge soon after its election as the new
root, e.g., upon expiration of the Topology Change Timer immediately subsequent to its
election."
::= 1
A v1 trap begins with an object name followed by the keyword TRAP-TYPE. This is followed by a number of sections and ends with the ::= entry and a number. Curly brackets ({}) are never used before, or after, a number.
A MACRO object defines the format of other MIB objects. MACRO definitions always begin with the object type, followed by the MACRO keyword, and then the ::= entry. The remainder of the macro definition is enclosed in BEGIN and END tags, for example:
OBJECT-TYPE MACRO ::=
BEGIN
TYPE NOTATION ::= "SYNTAX"
type (TYPE ObjectSyntax) "ACCESS" Access "STATUS" Status VALUE NOTATION ::= value
(VALUE ObjectName) Access ::= "read-only" | "read-write" | "write-only" | "not-accessible"
Status ::= "mandatory" | "optional" | "obsolete"
END
snmpInPkts OBJECT-TYPE SYNTAX Counter ACCESS read-only STATUS mandatory DESCRIPTION
"The total number of Messages delivered to the SNMP entity from the transport
service." ::= { snmp 1 }
These objects begin with an object name, which must begin with a lowercase alphabetic character. This is followed by a keyword that indicates the object type. Any additional sections follow the keyword, and the ::= entry, and a list of ancestors in curly brackets ({}) completes the format. The ancestors inside the curly brackets ({}) can have one of two formats. In the first (shown above) the format is an object name followed by a number. The object name is the name of this object’s immediate parent and the number is the leaf number of this object to the parent.
internet OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 }
In this example, the list starts at a known object (iso being the root of the tree) and continues to define object names and leaf numbers for each successive generation, org(3) and dod(6), until the final single integer (1) which indicates the object number. Note that spaces between the object names and the object numbers are not allowed.