snmp_walk.pl

Performs an SNMP walk of all or part of a device using the SNMP helper.

Description

The snmp_walk.pl script walks the entire device MIB (starting from internet by default) or part of the MIB.

By default, the script writes output to screen. You can change how the script writes output using the -format option.

Restriction:

Before running this script, ensure that the Helper Server process, ncp_d_helpserv, and either the master process controller, ncp_ctrl, or the SNMP helper process, ncp_dh_snmp, are running in the required domain.

Troubleshooting

This script accesses devices through the SNMP Helper and uses the community strings that are configured in the SNMP Helper. You can configure community strings and other aspects of device access using the Discovery Configuration GUI.

Network latency or congestion between the polling station and the device management node can cause delays in responding to the script.

To troubleshoot problems with the script, complete the following steps.

  1. Find the process ID of the SNMP Helper by issuing the following command: ps -aef | grep dh_snmp
  2. Increase the log and trace level of the SNMP Helper by issuing the following commands:

    kill -usr1 process_id
    kill -usr1 process_id
    kill -usr2 process_id
    kill -usr2 process_id
    kill -usr2 process_id
    kill -usr2 process_id

    Where process_id is the process ID of the SNMP Helper.

  3. Run the snmp_walk.pl script.
  4. Check the ncp_dh_snmp.log and ncp_dh_snmp.trace files in the $NCHOME/log/precision directory.

Running the script

To run the script, use a command line similar to the following:
$NCHOME/precision/bin/ncp_perl $NCHOME/precision/scripts/perl/scripts/snmp_walk.pl -domain domain_name [
 -debug ] [ -format ] [ -help ] [ -ignoreInstanceFilters ] [ -latency ] [ -quiet ]
 IP_address OID|MIB_variable [ community_add_on ]
Note: You can configure this script to ignore SNMP interface filters. For more information on SNMP interface filtering, see SNMP interface filtering.

Examples

The following example command line performs a walk of the ifTable of a device with IP address 1.2.3.4. The ifTable is specified as a MIB variable. Output is written to screen.

$NCHOME/precision/bin/ncp_perl $NCHOME/precision/scripts/perl/scripts/snmp_walk.pl -domain TEST 1.2.3.4 ifTable

The following example command line performs a walk of the ifTable of a device with IP address 1.2.3.4 with a VLAN context. Output is written to screen.

$NCHOME/precision/bin/ncp_perl $NCHOME/precision/scripts/perl/scripts/snmp_walk.pl -domain TEST -format out 1.2.3.4 ifTable @vlan2

Command-line options

The following table describes the command-line options for the script.

Table 1. snmp_walk.pl command-line options
Command-line option Description
-debug Optional; sets the debug level for the process, from 1 to 4.
-domain Domain

Mandatory; the domain containing the device on which to perform the SNMP walk.

-format

By default, the script writes output to screen. You can change this behavior using the -format option.

Possible options are:
  • name - writes the retrieved data, by name, to file. The file is called IP_address.Starting_OID.MIB_name.
  • oid - writes the retrieved data, by OID, to file. The file is called IP_address.Starting_OID.OID_name.
  • out - writes the retrieved data, by name, to screen (stdout).

You can specify more than one -format option.

-help Optional; provides help on this script.
-ignoreInstanceFilters Optional; returns all information from the device, ignoring any interface filters.
IP_address An IP address of the device. The address must be accessible using SNMP. You cannot use device names.
-latency Optional; specifies the timeout, in milliseconds, to wait for a response from the SNMP helper.
OID|MIB_variable Mandatory. The MIB node from which to begin the SNMP walk. The node can be expressed as an OID (for example, 1.3.6.1.2.1.2.2.1.1), or as a MIB variable (for example, ifIndex).
-quiet Optional; outputs only retrieved data and essential information.
community_add_on Optional; additional context to the community string.