SNMP GETNEXT Command

Read syntax diagramSkip visual syntax diagram SNMP GETNEXT host com_name var_name

Purpose

Use the SNMP GETNEXT command in the following format to obtain the next variable in the MIB tree from an SNMP agent.
Note: This command is one of the NETVIEW SNMP client commands and NETVIEW is required.

Operands

host
Specifies the name of the destination host where the SNMP request is sent. The host can be specified with its name or with its IP address in dotted-decimal notation.
Note: The SNMP Query Engine treats numbers with leading zeros as octal numbers. Therefore, do not use leading zeros.
com_name
Specifies the community name to use when querying the SNMP agent on the destination host.
Note: This parameter is case sensitive.
var_name
Specifies one or more MIB variable names to be obtained. You can specify the names in short form or in ASN.1 notation (for example, sysDescr.0 or 1.3.6.1.2.1.1.1.0). Currently, a maximum of 10 variables for each request is implemented in the SNMP Query Engine.
Note: This parameter is not case sensitive.

Usage Notes

  1. You must specify the host name or IP address of the host where the agent is running, as well as the community name to be used when making the query. You must specify the name of the variable preceding the desired variable. In addition to the standard MIBs, there may be enterprise-specific variables as defined by the implementer of a particular SNMP agent.
  2. The GETNEXT command is used to interrogate a table (for example, the interface table) or an array. You can issue a GETNEXT command at the start of a table (use instance 0.0). The first element in the table is returned. The process continues in a loop, performing GETNEXT requests on the previously obtained variable name, until the name of the variable returned no longer has the same prefix as the one at the start of the table. This condition occurs when the GETNEXT request returns a variable that is in the next group.

Examples

  • If you know:
    hostname            -  anyhost
    IP address          -  129.34.222.72
    community name      -  public
    variable name       -  ifAdminStatus (in ifTable)
    asn.1 variable name -  1.3.6.1.2.1.2.2.1.7
    You can issue an SNMP GETNEXT command in one of the following ways:
    snmp getnext 129.34.222.72 public 1.3.6.1.2.1.2.2.1.7.0
    snmp getnext 129.34.222.72 public ifAdminStatus.0
    snmp getnext anyhost public 1.3.6.1.2.1.2.2.1.7.0
    snmp getnext anyhost public ifAdminStatus.0
  • The GETNEXT command is completed in the same manner as the GET command, and you receive an asynchronous response similar to the following example.
    The first instance of the variable has a status of 1 or greater (ends in 7.1) in this example:
    SNM040I SNMP Request 1001 from NETOP Returned the following response:
    SNM042I Variable name: 1.3.6.1.2.1.2.2.1.7.1
    SNM043I Variable value type: 1
    SNM044I Variable value: 1
    SNM049I SNMP Request 1001 end of response
    You can then issue another GETNEXT command in one of the following ways:
    snmp getnext 129.34.222.72 public 1.3.6.1.2.1.2.2.1.7.1
    snmp getnext 129.34.222.72 public ifAdminStatus.1
    snmp getnext anyhost public 1.3.6.1.2.1.2.2.1.7.1
    snmp getnext anyhost public ifAdminStatus.1
  • The GETNEXT command is completed in the same manner as the GET command, and you receive an asynchronous response similar to the following example.
    The second instance of the variable has a status of 1 or greater (ends in 7.2) in this example:
    SNM040I SNMP Request 1002 from NETOP Returned the following response:
    SNM042I Variable name: 1.3.6.1.2.1.2.2.1.7.2
    SNM043I Variable value type: 1
    SNM044I Variable value: 1
    SNM049I SNMP Request 1002 end of response
    You can then issue another GETNEXT command in one of the following ways:
    snmp getnext 129.34.222.72 public 1.3.6.1.2.1.2.2.1.7.2
    snmp getnext 129.34.222.72 public ifAdminStatus.2
    snmp getnext anyhost public 1.3.6.1.2.1.2.2.1.7.2
    snmp getnext anyhost public ifAdminStatus.2
  • The GETNEXT command is completed in the same manner as the GET command, and you receive an asynchronous response similar to the following:
    SNM040I SNMP Request 1003 from NETOP Returned the following response:
    SNM042I Variable name: 1.3.6.1.2.1.2.2.1.8.1
    SNM043I Variable value type: 1
    SNM044I Variable value: 1
    SNM049I SNMP Request 1003 end of response

    The returned variable is the first entry in the next instance, which has a value of 1 or greater (ends in 8.1 rather than 7.x). The returned variable indicates that the end of the table for the ifAdminStatus variable has been reached.