snmp_request - Sends SNMPv1 and SNMPv2 request PDUs to an
agent and prints the agent's response
/usr/sbin/snmp_request agent community request_type [-v
version] [-p port] [-l] [-t] [-d] [-n non_repeaters] [-m
max_repetitions] [-r retry_count] [-w wait_seconds_max]
{variable [type value]}
Specifies the type of message in which to send the PDU.
The default version is SNMPv1. Use 2c to specify that the
PDU be sent in an SNMPv2C message. If the request_type is
getbulk, you must set the version to SNMPv2C (-v 2c).
Specifies the port on the managed node to which to send
the SNMP request. The default is port 161, the well-known
SNMP port. Specifies loop mode. This option is valid
only if request_type is getnext or getbulk. This directs
the agent to perform a MIB walk. The name of the variable
returned by the agent is used in a subsequent request. The
program reads and prints responses, and issues requests,
until the agent has no more data, times out, or is interrupted
by a user. If you specify the -l option and the -t
option, the -l option is ignored. Specifies the number of
variables for which no repetition is requested. This is
required when request_type is getbulk. If you specify
either the -t or -l options for getbulk requests, this
value must be 0. Specifies the number of repetitions
requested for the repeating variables. This is required
when request_type is getbulk. If you specify either the -t
or -l options for getbulk requests, this value must be 1.
Specifies the number of times to resend an SNMP request.
If the agent does not reply before wait_seconds_max, the
request is resent until the retry count reaches 0. The
default value is 0. Specifies a tree walk. This option
is valid only if request_type is getnext or getbulk. This
directs the agent to perform a MIB walk for the subtree
with the variable parameter as its root. The program reads
and prints responses, and issues requests, until the agent
has no more data for the specified subtree, times out, or
is interrupted by a user. Only one OID is permitted for a
tree walk. Specifies the maximum number of seconds to
wait for a reply from the agent. The default is 3 seconds.
Specifies the object identifier of a MIB variable (in dot
notation).
For Get and Set operations, the object identifier
must be fully qualified; it must specify an
instance. Specifies the data type for SetRequests.
The type parameter can be one of the following: a
-- ip_addr c -- Counter 32 d -- Object identifier
(in dot notation) D -- Display string g -- Gauge i
-- Integer l -- Counter 64 o -- Octet string (in
hexadecimal format) N --- Null q -- Opaque string
(in hexadecimal format) t -- time_ticks Specifies
the data value for SetRequests. The data value
must correspond to the data type.
Specifies the host name or IP address (in dot notation) of
the managed node to query. Specifies the community name
to use in the SNMP message header. Specifies the type of
protocol data unit (PDU) to send. The request_type can be
one of the following: get -- Get Request PDU getbulk --
GetBulk Request PDU getnext -- GetNext Request PDU set --
SetRequest PDU
The snmp_request program sends an SNMP Get, GetBulk, GetNext,
or Set request to a logically remote SNMP agent, and
prints the agent's response.
To obtain the value of the MIB II sysDescr variable from
host ZIGGY, using the default community name, enter:
snmp_request ZIGGY public get 1.3.6.1.2.1.1.1.0 To set
ZIGGY's sysContact variable to Katy Lied, enter:
snmp_request ZIGGY special_comm_1 set 1.3.6.1.2.1.1.4.0 \
-D "Katy Lied"
Be sure to use a community name that has been configured
on that system to allow sets. To obtain
the values of the MIB II sysUpTime.0 and sysDescr.0
variables and, for the first three interfaces, the
values of ifDescr and ifType from the agent on host
marley, using the SNMPv2 GetBulk PDU, enter:.
snmp_request marley public getbulk -v 2c -n 2 \ -m
3 1.3.6.1.2.1.1.1 1.3.6.1.2.1.1.2
1.3.6.1.2.1.2.2.1.2 \ 1.3.6.1.2.1.2.2.1.3 To obtain
the values of the MIB II hrDeviceDescr variables,
enter: snmp_request marley public getnext -t
1.3.6.1.2.1.25.3.2.1.3
Commands: snmpd(8), snmp_traprcv(8), snmp_trapsnd(8)
snmp_request(8)
[ Back ] |