Previous Table of Contents Next


The key difference between the GetRequest and the GetNextRequest PDUs is the word lexicographical. That means that the GetNextRequest retrieves the value of the next object within the agent’s MIB View. Section 4.4.2 provides an example.

Three error conditions are possible:

  If a variable in the Variable Bindings field does not lexicographically precede the name of an object that may be retrieved (that is, an object available for Get operations and within the relevant MIB View), the agent returns a GetResponse PDU with Error Status = noSuchName, and with the Error Index indicating the index of the variable in question. This condition is called “running off the end of the MIB View.”
  If the size of the appropriate GetResponse PDU exceeds a local limitation, the agent returns a GetResponse PDU of identical form, with Error Status = tooBig and Error Index = 0.
  If the value of the lexicographical successor to a requested variable in the Variable Bindings field cannot be retrieved for any other reason, the agent returns a GetResponse PDU, with Error Status = genErr, and the Error Index indicating the index of the variable in question.

4.3.4 Using the SetRequest PDU

The manager uses the SetRequest PDU to assign a value to an object residing in the agent. As you can see in Figure 4-9, to generate that PDU the manager assigns PDU Type = 3, specifies a locally defined Request ID, and sets both the ErrorStatus and ErrorIndex to 0. A VarBindList, containing the specified variables and their corresponding values, completes the PDU. When the agent receives the SetRequest PDU, it alters the values of the named objects to the values in the variable binding. Under error-free conditions, the agent generates a GetResponse PDU of identical form, except that the assigned PDU Type = 2, Error Status = noError, and Error Index = 0

Four error conditions are possible:

  If a variable in the Variable Bindings field is not available for Set operations within the relevant MIB View, the agent returns a GetResponse PDU of identical form, with Error Status = noSuchName, and with the Error Index indicating the index of the object name in question. (Historical note: Some agent implementations return Error Status = readOnly if the object exists, but Access = read-only for that variable.)
  If the value of a variable named in the Variable Bindings field does not conform to the ASN.1 Type, Length, and Value required, the agent returns a GetResponse PDU of identical form, with Error Status = badValue and the Error Index indicating the index of the variable in question.
  If the size of the appropriate GetResponse PDU exceeds a local limitation, the agent returns a GetResponse PDU of identical form, with Error Status = tooBig, and Error Index = 0.
  If the value of a variable cannot be altered for any other reason, the agent returns a GetResponse PDU of identical form, with Error Status = genErr and the Error Index indicating the index of the variable in question.

4.3.5 The Trap PDU Format

The Trap PDU has a format distinct from the four other SNMP PDUs, as you can see in Figure 4-10. The first field indicates the Trap PDU and contains PDU Type = 4. The Enterprise field identifies the management enterprise under whose registration authority the trap was defined. For example, the OID prefix {1.3.6.1.4.1.110} would identify Network General Corp. as the Enterprise sending a trap. The Agent Address field, which contains the IP address of the agent, provides further identification. If a non-IP transport protocol is used, the value 0.0.0.0 is returned.

The Generic Trap type provides more specific information on the event being reported. There are seven defined values (enumerated INTEGER types) for this field:

Trap Value Meaning

coldStart 0 The sending protocol entity (higher-layer network management) has reinitialized, indicating that the agent’s configuration or entity implementation may be altered.
warmStart 1 The sending protocol has reinitialized, but neither the agent’s configuration nor the protocol entity implementation has been altered.
linkDown 2 A communication link has failed. The affected interface is identified as the first element within the Variable Bindings field: name and value of the ifIndex instance.
linkUp 3 A communication link has come up. The affected interface is identified as the first element within the Variable Bindings field: name and value of the ifIndex instance.
authenticationFailure 4 The agent has received an improperly authenticated SNMP message from the manager; that is, the community name was incorrect.
egpNeighborLoss 5 An EGP peer neighbor is down.
enterpriseSpecific 6 A nongeneric trap has occurred, which is further identified by the Specific Trap Type field and Enterprise field.

Two additional fields complete the Trap PDU. The Timestamp field contains the value of the sysUpTime object, representing the amount of time elapsed between the last (re-)initialization of the agent and the generation of that Trap. The last field contains the Variable Bindings.

4.3.6 Using the Trap PDU

The agent uses the Trap PDU to alert the manager that a predefined event has occurred. To generate the Trap PDU, the agent assigns PDU Type = 4 and fills in the Enterprise, Agent Address, Generic Trap, Specific Trap Type, and Timestamp fields, as well as the Variable Bindings list.

By definition (and convention), Traps are application specific. Therefore, it would be difficult to cover the range of uses for this PDU. RFC 1215, “A Convention for Defining Traps for Use with the SNMP,” offers some guidelines for their use [4-5]. Figure 4-11 illustrates how an agent in a router could use a Trap to communicate a significant event to the manager. Section 4.4.4 provides an example of a real-world application.

4.3.7 SNMP PDU Encoding

Recall from our discussion in Chapter 2 that the SNMP PDUs are encoded using the context-specific class, with a tag that identifies the PDU (review Figure 2-15). The Length and Value fields are then constructed to convey a particular structure and quantity of information. Now that we have discussed the structure of the SNMP PDUs, we can revisit these encodings in more detail.


Previous Table of Contents Next