Questo argomento descrive i formati degli oggetti MIB validi.
Le sezioni di seguito riportate descrivono i formati degli oggetti MIB SNMP validi.
Un oggetto TC (TEXTUAL-CONVENTION) v2 presenta la seguente sintassi, dove il nome oggetto è seguito dalla voce ::=, quindi da TEXTUAL-CONVENTION. Seguono varie sezioni aggiunte con la definizione SYNTAX.
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))
Un TC v1 è costituito da un nome oggetto seguito dalla voce ::= e viene quindi aggiunto con una definizione SYNTAX valida. Ad esempio:
DisplayString ::= OCTET STRING
Entrambi gli oggetti sono presenti all'esterno della struttura ad albero MIB e non sono quindi oggetti di MIB. Rappresentano un formato per cui può essere definita una sintassi. Non presentano alcun OID. Possono essere visualizzati nella vista Moduli MIB, in un filtro separato, facendo clic sull'elenco a discesa Visualizza e selezionando Convenzioni testuali.
L'oggetto TRAP-TYPE è valido per MIB v1. Questi oggetti non erano in origine definiti per adattarsi perfettamente alla struttura ad albero MIB. Non presentano un OID ma presentano un ID aziendale e un numero di trap, ad esempio:
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
Un trap v1 inizia con un nome oggetto seguito dalla parola chiave TRAP-TYPE. Questo è seguito da un numero di sezioni e termina con la voce ::= ed un numero. La parentesi graffe ({}) non vengono mai utilizzate prima o dopo un numero.
Un oggetto MACRO definisce il formato di altri oggetti MIB. Le definizioni MACRO iniziano sempre con i tipi di oggetto seguiti dalla parola chiave MACRO, quindi, dalla voce ::=. Il resto della definizione di macro è racchiusa nei tag BEGIN e END, ad esempio:
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 }
Questi oggetti iniziano con un nome oggetto che deve iniziare con un carattere alfabetico minuscolo. Questo nome è seguito da una parola chiave che indica il tipo di oggetto. Una sezione aggiuntiva segue la parola chiave e la voce ::= ed un elenco di antenati in parentesi graffe ({}) completano il formato. Gli antenati all'interno delle parentesi graffe ({}) possono avere uno di due formati. Nel primo (riportato sopra), il formato è un nome oggetto seguito da un numero. Il nome oggetto è il nome del parent immediato dell'oggetto e il numero è il numero foglia di questo oggetto rispetto al parent.
internet OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 }
Nell'esempio precedente, l'elenco inizia con un oggetto conosciuto (iso come root della struttura ad albero) e continua per definire i nomi oggetto e i numeri foglia per ciascuna generazione successiva, org(3) e dod(6), fino al numero singolo finale (1) che indica il numero dell'oggetto. Non sono consentiti spazi tra i nomi oggetto e i numeri oggetto.