snmptest man page on SunOS

Man page or keyword search:  
man Server   20652 pages
apropos Keyword Search (all sections)
Output format
SunOS logo
[printable version]

snmptest(1M)		System Administration Commands		  snmptest(1M)

NAME
       snmptest - communicate with a network entity using SNMP requests

SYNOPSIS
       /usr/sfw/bin/snmptest [common options] agent

DESCRIPTION
       snmptest	 is  a	flexible  SNMP application that can monitor and manage
       information on a network entity.

       Invoking snmptest invokes a command line interpreter that accepts  com‐
       mands.  This  intepreter	 enables  you  to send different types of SNMP
       requests to target agents.

       The operand agent identifies a target SNMP agent that  is  instrumented
       to monitor manageable objects. At its simplest, the agent specification
       consists of a host name or an IPv4 address. In this situation, the com‐
       mand  attempts communication with the agent, using UDP/IPv4 to port 161
       of the target host. See snmpcmd(1M) for a full  list  of	 the  possible
       formats for agent.

       After you invoke snmptest, the command line intepreter prompts with:

       Variable:

       At this point you can enter one or more variable names, one per line. A
       blank line ends the parameter input and sends  the  request  (variables
       entered) in a single packet to the remote entity. Each variable name is
       given in the format specified in snmp_variables(4).  For	 example,  the
       command:

       snmptest -c public -v 1 zeus
       Variable: system.sysDescr.0
       Variable:

       ...returns  information about the request and reply packets, as well as
       the data:

       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  pos‐
       sible  values  for errstat are in the header file /usr/sfw/include/net-
       snmp/library/snmp.h. The errindex value identifies  the	variable  that
       has an 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 that 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.

       The following are valid request types:

       GET request

	   When in "GET request" mode ($G or default), you can enter an OID at
	   the Variable: prompt. You can enter multiple OIDs, one per  prompt.
	   Enter 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, 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.	To  enter  an  integer
	   value,  just	 type  the  integer  (in  decimal). If it is a decimal
	   string, type in whitespace-separated decimal numbers, one per  byte
	   of  the  string.  Again,  enter  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. Note, however, that GETBULK is not available in SNMPv1.

       Inform request

	   The	"Inform	 request"  mode	 ($I)  is similar to the "SET request"
	   mode. However, this type of request is  not	available  in  SNMPv1.
	   Also, the agent specified in 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.  However,  this  type	of request is not available in SNMPv1.
	   Also, the agent specified in the snmptest command should correspond
	   to the target snmptrapd agent.

OPTIONS
       snmptest takes the common options described in the snmpcmd(1M).

EXAMPLES
       Example 1: Sending a GET Request for Two OIDs

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

       % snmptest -v 2c -c public testhost:161

       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

       Example 2: Sending a GETNEXT Request

       The following is an example of sending a GETNEXT request:

       Variable: $N
       Request type is Getnext Request
       Variable: SNMPv2-MIB::sysORUpTime.1
       Variable:
       Received Get Response from 128.2.56.220
       requestid 0x7D9FCD64 errstat 0x0 errindex 0x0
       SNMPv2-MIB::sysORUpTime.2 = Timeticks: (6) 0:00:00.06
       Variable:

       Example 3: Sending a SET Request

       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:

       Example 4: Sending a GETBULK Request

       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:

       Example 5: Sending an Inform Request

       The following is an example of sending an Inform request:

       snmptest -v 2c -c public snmptrapd_host:162
       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

       Example 6: Sending an SNMPv2 Trap Request

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

       snmptest -v 2c -c public snmptrapd_host:162
       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

EXIT STATUS
       0	Successful completion.

       1	A  usage syntax error. A usage message is displayed. Also used
		for timeout errors.

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌─────────────────────────────┬─────────────────────────────┐
       │      ATTRIBUTE TYPE	     │	    ATTRIBUTE VALUE	   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Availability		     │SUNWsmcmd			   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Interface Stability	     │External			   │
       └─────────────────────────────┴─────────────────────────────┘

SEE ALSO
       snmpcmd(1M), snmpget(1M), snmpset(1M), snmp_variables(4), attributes(5)

SunOS 5.10			  23 Jan 2004			  snmptest(1M)
[top]

List of man pages available for SunOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net