Important This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent for BMC Helix Operations Management 24.1.

snmp_walk()


Return subsequent variables from the Management Information Base (MIB) on the agent that the SNMP session is opened with.

Syntax

snmp_walk(session,variable)

Parameter

Parameter

Definition

session

ID of the SNMP session to which the series of SNMP get-next-request commands will be submitted Thesession is the ID returned when an snmp_open() function is executed.

variable

name of an SNMP MIB variable, which can be specified in numeric form or in symbolic form if the MIB is known to the PATROL Agent.

Description

The snmp_walk() function returns all variables in the subtree for variable in the Management Information Base (MIB). The subtree for variable includes all variables of the form variable.argument_sequence where variable is the prefix name. 

The snmp_walk() function returns the NULL string if an error occurs and sets the PSL errno variable as follows:

  • E_PSL_TIMEOUT if a timeout occurs during the request
  • E_PSL_SNMP_ERROR if an error is returned in the response packet from the SNMP session

Output Format

The output of the snmp_walk() function is a s list of SNMP variables in the following format: 

name type length value

Field

Definition

name

name of an SNMP MIB variable

type

character string indicating the name type

length

length of value

value

value of name

 

The timeticks, gauge, and counter variable types are followed by an extra new line character (\n). The extra new line character creates a blank line after these variable types in the snmp_walk() function output.

Example

The following example uses the snmp_walk() function to print all the application instances in the PATROL MIB. It is a more efficient form of a similar example using the snmp_get_next() function (see Example).

 

function main() {
local myhost,session,app_start;
myhost = get("/hostname");
session = snmp_open(myhost,"1","","","",8161);
app_start = ".1.3.6.1.4.1.1031.1.1.1.7.1.1";
printf("%s\n",snmp_walk(session,app_start));
snmp_close(session);
return;
}

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*