As shown in Figure 1, an SNMPv1/SNMPv2c packet is composed of the version, community name, and SNMP Protocol Date Unit (PDU) fields.
The following describes the fields in an SNMPv1/SNMPv2c packet:
Version: specifies the SNMP version. The value for SNMPv1 is 0 and for SNMPv2c is 1.
For simplification, the SNMP operations are described as the Get, GetNext, Set, Response, Trap, GetBulk, and Inform operations.
As shown in Table 1, SNMPv1/SNMPv2c defines seven types of operations for exchanging information between the NMS and agents.
Operation |
Description |
---|---|
Get |
Retrieves one or several variables from the MIB of an agent process. |
GetNext |
Retrieves the next variables in alphabetic order from the MIB of the agent process. |
Set |
Sets one or several variables in the MIB of the agent process. |
Response |
Returns one or several variables. The agent performs this operation in response to the GetRequest, GetNextRequest, SetRequest, and GetBulkRequest operations. Upon receiving a Get or Set request from the NMS, the agent queries or modifies the variables in the MIB, and returns variables to the NMS. |
Trap |
Notifies the NMS of a fault or event occurring on a managed device. This operation is performed by the agent. |
GetBulk |
Batch queries variables on managed devices. This operation is performed by the NMS. |
Inform |
Notifies the NMS of a fault or event occurring on a managed device. After a managed device sends an inform request, the NMS must send an InformResponse packet as a response to the managed device. |
SNMPv1 does not support the GetBulk and Inform operations.
Get
The agent authenticates the SNMP version and community name in the packet. If authentication is successful, the agent queries the sysContact value from the MIB, encapsulates the sysContact value into the PDU of a response packet, and sends the response packet to the NMS. If the agent fails to obtain the sysContact value, the agent returns an error message to the NMS.
GetNext
The agent authenticates the SNMP version and community name in the packet. If authentication is successful, the agent queries the sysName value from the MIB, encapsulates the sysName value into the PDU of a response packet, and sends the response packet to the NMS. If the agent fails to obtain the sysName value, the agent returns an error message to the NMS.
Set
The agent authenticates the SNMP version and community name in the packet. If authentication is successful, the agent sets the sysContact object to the expected value and sends a response packet to the NMS. If the setting fails, the agent returns an error message to the NMS.
Trap
Trap is a spontaneous activity of a managed device. The Trap operation is not a basic operation that the NMS performs on the managed device. If a trap triggering condition is met, a managed device sends a trap to notify the NMS of the exception. For example, when a managed device completes a warm start, the agent sends a warmStart trap to the NMS.
The agent sends a trap to the NMS only when a module on the managed device meets the trap triggering condition. This reduces management information exchange between the NMS and managed devices.
GetBulk
A GetBulk operation is equal to consecutive GetNext operations. You can set the number of GetNext operations to be included in one GetBulk operation.
Inform