snmptest is a flexible SNMP application that can monitor and manage information on a network entity.
After invoking the program, a command line interpreter proceeds to accept commands. This intepreter
enables the user to send different types of SNMP requests to target agents.
AGENT identifies a target SNMP agent, which is instrumented to monitor the given objects. At its
simplest, the AGENT specification will consist of a hostname or an IPv4 address. In this situation, the
command will attempt communication with the agent, using UDP/IPv4 to port 161 of the given target host.
See snmpcmd(1) for a full list of the possible formats for AGENT.
Once snmptest is invoked, the command line intepreter will prompt with:
Variable:
At this point you can enter one or more variable names, one per line. A blank line ends the parameter
input and will send the request (variables entered) in a single packet, to the remote entity. Each
variable name is given in the format specified in variables(5). For example:
snmptest -c public -v 1 zeus
Variable: system.sysDescr.0
Variable:
will return some information about the request and reply packets, as well as the information:
requestid 0x5992478A errstat 0x0 errindex 0x0
system.sysDescr.0 = STRING: "Unix 4.3BSD"
The errstatus value shows the error status code for the call. The possible values for errstat are in the
header file snmp.h. The errindex value identifies the variable that has the given error. Index values
are assigned to all the variables entered at the "Variable": prompt. The first value is assigned an index
of 1.
Upon startup, the program defaults to sending a GET request packet. The type of request can be changed
by typing one of the following commands at the "Variable:" prompt:
$G - send a GET request
$N - send a GETNEXT request
$S - send a SET request
$B - send a GETBULK request
Note: GETBULK is not available in SNMPv1
$I - send an Inform request
$T - send an SNMPv2 Trap request
Other values that can be entered at the "Variable:" prompt are:
$D - toggle the dumping of each sent and received packet
$QP - toggle a quicker, less verbose output form
$Q - Quit the program
Request Types:
GET Request:
When in "GET request" mode ($G or default), the user can enter an OID at the "Variable:" prompt. The user
can enter multiple OIDs, one per prompt. The user enters a blank line to send the GET request.
GETNEXT Request:
The "GETNEXT request" mode ($N) is similar to the "Get request" mode, described above.
SET Request:
When in the "SET request" mode ($S), more information is requested by the prompt for each variable. The
prompt:
Type [i|s|x|d|n|o|t|a]:
requests the type of the variable be entered. Depending on the type of value you want to set, you can
type one of the following:
i - integer
u - unsigned integer
s - octet string in ASCII
x - octet string in hex bytes, separated by whitespace
d - octet string as decimal bytes, separated by whitespace
a - ip address in dotted IP notation
o - object identifier
n - null
t - timeticks
At this point a value will be prompted for:
Value:
If this is an integer value, just type the integer (in decimal). If it is a decimal string, type in
white-space separated decimal numbers, one per byte of the string. Again type a blank line at the prompt
for the variable name to send the packet.
GETBULK Request:
The "GETBULK request" mode ($B) is similar to the "Set request" mode. GETBULK, however, is not available
in SNMPv1.
Inform Request:
The "Inform request" mode ($I) is similar to the "Set request" mode. This type of request, however, is
not available in SNMPv1. Also, the _agent_ specified on the snmptest command should correspond to the
target snmptrapd agent.
SNMPv2 Trap Request:
The "SNMPv2 Trap Request" mode ($T) is similar to the "Set request" mode. This type of request, however,
is not available in SNMPv1. Also, the _agent_ specified on the snmptest command should correspond to the
target snmptrapd agent.