snmp_h_get_next()
Return variables from the PATROL SNMP Management Information Base (MIB) that are lexicographically next to the specified variable names using a brief (local) session and default parameters.
Syntax
Parameter
Parameter | Definition |
---|---|
host | name of the computer to which the SNMP get-next-request is submitted The host must be a name known to the local computer in the /etc/hosts file, the Domain Name System (DNS), the Network Information Service (NIS), or an IP address. |
variablen | variable name which is to receive a value from the SNMP MIB for session The string variablen is used to find the variable in the MIB whose name is the nearest alphabetically greater name than variablen. The value of that variable is returned. One variable name is required; additional variable names are optional. |
Description
The snmp_h_get_next() function is the equivalent of the following series of PSL function calls:
snmp_get(session,variable1,...,variablen);
snmp_close(session);
The snmp_h_get_next() function performs the following tasks:
- opens an SNMP session on host (For the default parameters used to open the session, see snmp_open().)
- sends an SNMP get-next-request command to the session to retrieve the value of the Management Information Base (MIB) variable whose name is lexicographically next to the name variablen
- closes the SNMP session
The snmp_h_get_next() function returns a space-separated list of the variables and their MIB names or the NULL string if an error occurs.
The snmp_h_get_next() function can set the PSL errno value to one of the following values:
errno Value | Description |
---|---|
95 | E_PSL_TIMEOUT -- request timed out |
100 | E_PSL_SNMP_ERROR -- error is returned in the response packet from the SNMP session |
Output Format
The output of the snmp_h_get_next() function is a s list of SNMP variables in the following format:
Field | Definition |
---|---|
name | name of an SNMP MIB variable |
type | character string indicating the name type |
length | length of value |
value | value of name |
Example
The following example uses the snmp_h_get_next() function to retrieve the second application instance name from the PATROL MIB:
local myhost,param;
myhost = get("/hostname");
param = ".1.3.6.1.4.1.1031.1.1.1.6.1.1.0";
printf("%s\n",trim(snmp_h_get_next(myhost,param),"\n"));
return;
}