snmptest

communicates with a network entity using SNMP requests 

Command


SYNOPSIS

snmptest [COMMON_OPTIONS]


DESCRIPTION

The snmptest utility 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. It will prompt with:

Variable:

At this point you can enter one or more variable names, one per line. A blank line is a command to send a request for each of the variables (in a single packet) to the remote entity. Each variable name is given in the format specified in snmp_variables.

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"

Upon startup, the program defaults to sending a GET request packet. This can be changed to a GETNEXT request or a SET request by typing the commands $N or $S respectively. Typing $G will go back to the GET request mode.

The command $D will toggle the dumping of each sent and received packet.

The command $QP will toggle a quicker, less verbose output form.

When in the "SET request" mode, 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. Type i for an integer, s for an octet string in ASCII, x for an octet string as hex bytes separated by whitespace, d for an octet string as decimal bytes separated by whitespace, a for an ip address in dotted IP notation, and o for an object identifier. 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.

At the variable name line, typing $Q will quit the program.

Options

snmptest takes the common options described in the snmpcmd reference page.


EXAMPLES

The following is an example of sending a GET request for two OIDs:

$ snmptest -v 2c -c public testhost:9999

Variable: system.sysDescr.0
Variable: system.sysContact.0
Variable:
Received Get Response from 128.2.56.220
requestid 0x7D9FCD63 errstat 0x0 errindex 0x0
SNMPv2-MIB::sysDescr.0 = STRING: SunOS testhost 5.9 Generic_112233-02 sun4u
SNMPv2-MIB::sysContact.0 = STRING: x1111

The following is an example of sending a GETNEXT request:

Variable: SNMPv2-MIB::sysORUpTime
Variable:
Received Get Response from 128.2.56.220
requestid 0x7D9FCD64 errstat 0x0 errindex 0x0
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (6) 0:00:00.06
Variable:

The following is an example of sending a SET request:

Variable: $S
Request type is Set Request
Variable: system.sysLocation.0
Type [i|u|s|x|d|n|o|t|a]: s
Value: building 17
Variable:
Received Get Response from 128.2.56.220
requestid 0x7D9FCD65 errstat 0x0 errindex 0x0
SNMPv2-MIB::sysLocation.0 = STRING: building A
Variable:

The following is an example of sending a GETBULK request:

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:
Now input the repeating variables
Variable: system.sysContact.0
Variable: system.sysLocation.0
Variable:
What repeat count? 2
Received Get Response from 128.2.56.220
requestid 0x2EA7942A errstat 0x0 errindex 0x0
SNMPv2-MIB::sysName.0 = STRING: testhost
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (58) 0:00:00.58
SNMPv2-MIB::sysLocation.0 = STRING: bldg A
SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB
Variable:

The following is an example of sending an Inform request:

$ snmptest -v 2c -c public snmptrapd_host

Variable: $I
Request type is Inform Request
(Are you sending to the right port?)
Variable: system.sysContact.0
Type [i|u|sIx|d|n|o|t|a]: s
Value: x12345
Variable:
Inform Acknowledged
Variable:

The snmptrapd_host will show:

snmptrapd_host [<ip address>]: Trap SNMPv2-MIB::sysContact.0 = STRING: x12345

The following is an example of sending an SNMPv2 Trap request:

$ snmptest -v 2c -c public snmptrapd_host

Variable: $T
Request type is SNMPv2 Trap Request
(Are you sending to the right port?)
Variable: system.sysLocation.0
Type [i|u|s|x|d|n|o|t|a]: s
Value: building a
Variable:

The snmptrapd_host will show:

snmptrapd_host [<ip address>]: Trap SNMPv2-MIB::sys.0 = STRING:
building a

PORTABILITY

All UNIX systems. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
snmpget, snmpset

Miscellaneous:
snmp_variables, snmpcmd


PTC MKS Toolkit 10.4 Documentation Build 39.