Monitor and manage information on a network entity


snmptest [-d] [-p port] [-r retry] [-t timeout]
         -v 1 host community

snmptest [-d] [-p port] [-r retry] [-t timeout] 
         [-v 2] host noAuth

snmptest [-d] [-p port] [-r retry] [-t timeout] 
         [-v 2] host srcparty dstparty context

Runs on:



Dump input and output packets.
-p port
Specify the destination port number.
-r retry
Specify the number of retries.
-t timeout
Specify the timeout (in seconds).
-v 1|2
SNMP version (default is 2).
The community name for the transaction with the remote system.
The collection of object resources that can be queried by the dstparty.
The name of the party providing information.
An Internet address specified in dot notation or a host name.
The name of the party requesting information.


The snmptest utility enables you to monitor and manage information on a network entity using SNMP (Simple Network Management Protocol). There are two different versions of SNMP commonly in use: SNMPv1 and SNMPv2; future versions are planned.

In SNMP terms, a server is called an agent and a client is called a manager. Agents and managers exchange network information using protocol data units (PDUs). The manager sends a PDU requesting information to the agent; the agent responds by retrieving the information from the network's management information database (MIB) and sending a response PDU back to the manager. The manager can also request changes to MIB data or ask for automatic log traps by sending the agent different PDUs.

The snmptest utility provides an interactive facility for generating PDUs from the SNMP manager's command line.

You start an agent by running snmpd on a machine in your network.

You start an interactive manager session by invoking snmptest, after which, the utility prompts you with:


This starts your interactive session. You can enter one or more variable names, one per line. If you enter a blank line, snmptest sends a request for each of the variables (in a single packet) to the network entity. See the file mib.txt for the format specification of variable names.

For example for SNMPv1, you might enter:

snmptest -v 1 public

or for SNMPv2:

snmptest manager_party agent_party agent_context

If you had access to this host, you would get a prompt like this:


Now, if you respond like this:

Variable: system.sysdescr.0


After you enter the blank line, if your request was successful, snmptest will tell you that is has received a Get Response and will display information about the system.sysdescr.0 object.

By default, snmptest sends a GET request PDU but you can change this at the Variable: prompt by entering a $ command, as follows:

Enter this command: To:
$B Send a GetBulkRequest-PDU
$D Toggle the dumping of each sent and received packet
$G Send a GetRequest-PDU
$I Send an InformRequest-PDU
$N Send a GetNextRequest-PDU
$Q Quit the utility
$S Send a SetRequest-PDU
$T Send an SNMPv2-Trap-PDU

Here's a brief explanation of the PDUs:

GetBulkRequest-PDU ($B)
This returns information on several objects. You first specify any individual objects you are interested in, then a number corresponding to a particular object group, then the number of objects within that group you want to see. This is how such a session might go:
Variable: $B
Request type is Bulk Request
Enter a blank line to terminate the list of non-repeaters
and to begin the repeating variables
Variable: system.sysDescr.0
Now input the repeating variables
Variable: 3
What repeat count? 4
Received Get Response from
requestid 0x7C81 errstat 0x0 errindex 0x0
system.sysObjectID.0 = OID: enterprises.QNX-Systems.1.1
at.atTable.atEntry.atIfIndex. = 1
at.atTable.atEntry.atIfIndex. = 1
at.atTable.atEntry.atPhysAddress. =  Hex: 00 E0 29 34 6E 4D
at.atTable.atEntry.atPhysAddress. =  Hex: 00 01 02 C1 8C 40
There are a few things to notice about this sample session:
  • After you have entered a variable, nothing happens until you enter a blank line.
  • In this case we have chosen to enter only one variable, but you may enter as many variables as you want.
  • The non-repeaters variable sends a GetNextRequest-PDU, not a GetRequest-PDU.
  • The repeating variables request asks for the number of the object group from which you want start the bulk request (you'll find these numbers in the mib.txt file). In this case, it's 3 and that correlates to the Address Translation group (at).
  • The repeat count specifies the number of contiguous MIB database objects you want to inspect.
GetRequest-PDU ($G)
This is the default PDU. It asks the agent to send information about a network entity. The agent responds with a Response-PDU containing the information requested. For more information, see snmpget.
InformRequest-PDU ($I)
An SNMP manager uses this type of PDU to inform other managers about MIB information hidden from their view. An inform request is similar to a trap in that it can be used to send notification of an event that has occurred but, unlike a trap, an inform request is always acknowledged. This makes it a more reliable way of sending notifications than a trap, but also more expensive in terms of network resources.
GetNextRequest-PDU ($N)
This is similar to the GetRequest-PDU but it requests the next object in the MIB database.
SetRequest-PDU ($S)
This PDU changes objects in the MIB database on the agent machine. Such a session might go like this:
Variable: $S
Request type is Set Request
Variable: system.sysName.0
Type [i|s|x|d|n|o|t|a]: s
Value: James Bond
Received Get Response from
requestid 0x6EC5 errstat 0x0 errindex 0x0
system.sysName.0 = "James Bond"

In this session, we are requesting a change in the system name recorded in the MIB database on the agent machine. As long as we have permission to do this, snmptest asks for the variable we want to change, the type of data (a string in this case), and the new value. After we have entered the obligatory blank line, the object is changed and the new value is returned.

SNMPv2-Trap-PDU ($T)
Managers use this PDU to request an agent to report events asynchronously. When the specified events occur, the agent sends a trap to the requesting manager.
Note: Before you can send this PDU, you have to invoke snmptrapd on the machine running the agent.

If you enter $I, $S, or $T, snmptest requests information about each variable. First, it prompts you for the variable type:

Type [i|s|x|d|n|o|t|a]:
If the variable is: Enter:
integer i
string s
hex string x
decimal string d
null n
object id o
timeticks t
ip address a

After you enter a character, snmptest prompts you for a value:

For this variable type: Enter:
integer Integer in decimal.
ipaddress IP address in the standard internet dot notation.
object id Object ID in dotted numeric notation.
string Whitespace-delimited decimal numbers, one per byte of the string.
timeticks Integer in decimal.

If you're using SNMP version 2, the following files must be configured on the machine running the agent:

Based on:

RFC 1065, RFC 1066, RFC 1067, RFC 1441, RFC 1445, RFC 1446, RFC 1448, RFC 1449

Marshall T. Rose, The Simple Book: An Introduction to Internet Management, Revised 2nd ed. (Prentice-Hall, 1996, ISBN 0-13-451659-1)

Environment variables:

Specify the location of the mib.txt file. For example, MIBFILE=path/mib.txt (the default path is /etc).
If SUFFIX exists in your environment, all object IDs with a symbolic name are printed with only the last element. Examples:

This ID:


is printed as:


This ID:


is printed as: