Previous Topic: varbinds—Specify Variable Bindings for sendtrap

Next Topic: snmpset Utility--Set Value of an OID

snmpget Utility--Retrieve an OID value

The snmpget utility retrieves the value of a specific instance of a MIB attribute using SNMP. The OID of the attribute is printed followed by the value of the OID. Use the -w parameter to produce a more readable output similar to the walktree utility.

This utility has the following format:

snmpget
    [-h hostname | ip_addr]
    [-p port]
    [-c community]
    [-v {1 | 2c | 3}]
    [-u secName]
    [-s secLevel]
    [-n contextName]
    [-a authPassword] [-A {MD5 | SHA}]
    [-A authProtocol]
    [ -x privPassword] [-X {DES | AES | 3DES}]
    [ -X encryptProtocol]    
    [-m FIPS_mode]
    [-t timeout]
    [-d logLevel]
    [-f logFile]
    [-r retries]
    [-b]
    [-w]
    [-D]
    [-C [norepeaters,] maxrepeaters]
    [-o OID]

-h hostname | ipaddr

Specifies the host name or IP address of the system on which the agent is running. Accepts IPv4 and IPv6 addresses.

Default: localhost

-p port

Specifies the UDP port that the agent is running on (for example, 1691).

Default: 161

-c community

Specifies a community string that the agent uses. Valid for SNMPv1 and SNMPv2c only.

Note: Specify a read/write community string for snmpset.

Default: public

-v {1 | 2c | 3}

Indicates the version of SNMP that the agent is running. Specify 1 for SNMPv1, 2c for SNMPv2c, or 3 for SNMPv3.

Default: 1

-u secName

Specifies the User-based Security Model (USM) user name used for SNMPv3 security.

Default: none

-s secLevel

Specifies one of the following security levels for SNMPv3 communication:

-n contextName

Specifies the instance name for MIBMuxed agent.

Default: none

-a authPassword

Specifies the authentication password if the agent is configured for SNMPv3 with secLevel 2 (AuthNoPriv) or 3 (AuthPriv).

Note: This option is not required for SNMPv3 communication.

Default: none

-A {MD5 | SHA}

Specifies the authentication protocol to use if the agent is configured for SNMPv3 with secLevel 2 (AuthNoPriv) or 3 (AuthPriv). Currently only MD5 (Message Digest Algorithm) and SHA (Secure Hash Algorithm) are used.

Default: MD5

-A authProtocol

Specifies the authentication Protocol. The options of this parameter are similar to authPassword parameter options.

-x privPassword

Specifies the privacy (encryption) password if the agent is configured for SNMPv3 with secLevel 3 (AuthPriv).

Default: none

-X {DES | AES | 3DES}

Specifies the privacy protocol if the SNMPv3 user is configured with secLevel 3 (AuthPriv). Specify DES for Data Encryption Standard, AES for Advanced Encryption Standard using cryptographic keys of 128 bits (AES128), and 3DES for Triple Data Encryption Standard.

Default: none

-X encryptProtocol

Specifies the encryption Protocol. The options of this parameter are similar to privPassword parameter options.

-m FIPS_mode

Controls the FIPS mode of operation. Accepted values are 0, 1, and 2.

0

Indicates Non-FIPS mode.

1

Indicates FIPS co-existence mode.

2

Indicates FIPS only mode.

Default: 1

-r retries

Specifies the number of retries.

Default: 10

-t timeout

Specifies the duration before the SNMP receiver considers the request as timed out.

Default: 10 seconds

-d logLevel

Specifies the log level of the SNMP messages. Accepted values are 0 to 5.

0

Logs fatal messages.

1

Logs critical messages.

2

Logs warning messages.

3

Logs informational messages.

4

Logs all of the messages.

5

Logs all of the messages including debugging messages.

Default: 0

-f logfile

Specifies the name of the log file that contains error and debug information.

Default: sysedge_utility.log

-b

Displays the value in hexadecimal format. Applies to snmpget, snmpset, and walktree utilities only.

-w

Specifies to return walktree like format.

-D

Specifies to interpret data as DataAndTime type.

-C [norepeaters,] maxrepeaters

Specifies the bulk request to obtain values (tabular) for one or more than one MIB objects. The values are obtained by setting following options:

norepeaters

Specifies the position where the bulk request begins in the OIDs list.

maxrepeaters

Specifies the maximum number of OID values repeated to retrieve the bulk request.

-o OID

Specifies the object identifier (OID) to be set or queried for the snmpget, snmpset, and walktree utilities.

Default: none

Note: OID must be the last argument for snmpget. You can query multiple OIDs (separated by a blank space) in a single snmpget call. See the examples below.

snmpget Examples

snmpget -o 1.3.6.1.2.1.1.1.0
snmpget -o sysDescr.0
snmpget -h box1.domain.com -o 1.3.6.1.2.1.2.1.0  1.3.6.1.2.1.1.4.0 1.3.6.1.2.1.2.2.1.2.1 1.3.6.1.2.1.1.1.0
snmpget -p 2009 -c admin -v 1 -o 1.3.6.1.2.1.1.4.0
snmpget -c admin -v 2c -h Ea2f:fe90:abcd:0000:230:a2f:200:ad01 -b -o 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.2.2.1.2.1
snmpget -p 2009 -u user3v3 -v 3 -s 1 -o 1.3.6.1.2.1.2.1.0 1.3.6.1.2.1.2.2.1.1.1 1.3.6.1.2.1.2.2.1.2.1
snmpget -h 130.10.100.101 -p 2009 -u user2v3 -A SHA -a osa -v 3 -s 2 -m 2 -o 1.3.6.1.2.1.2.1.0 1.3.6.1.2.1.1.4.0
snmpget -p 2009 -u user1v3 -A SHA -a osa -X AES -x osp -v 3 -s 3 -t 30 -o 1.3.6.1.2.1.2.1.0 1.3.6.1.2.1.2.2.1.1.1 1.3.6.1.2.1.2.2.1.2.1 1.3.6.1.2.1.1.4.0
snmpget -C 1,3 -o 1.2.3.0 -o 1.2.3.1.0