snmp_h_set()
Open a brief PATROL SNMP session with default parameters to set variables in the SNMP Management Information Base (MIB).
Syntax
[...objectidn typen valuen])
Parameter
Parameter | Definition |
---|---|
host | name of the computer to which the SNMP set-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. |
objectidn | character string SNMP object identifier for the variable whose value is to be changed |
typen | character string indicating the objectidn type *Valid Values* |
valuen | value assigned to objectidn |
Description
The snmp_h_set() function is the equivalent of the following series of PSL function calls:
snmp_set(session,objectid1 type1 value1,...,
objectidn typen valuen);
snmp_close(session);
The snmp_h_set() 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 set-request to the session to set specified variables in the Management Information Base (MIB)
- closes the SNMP session
The three parts of the snmp_h_set() function variable replacement, objectidn, typen, and valuen must be separated by spaces.
The snmp_h_set() function returns the new value of the MIB variable, or when an error occurs, the NULL string or an error message.
MIB variable value
The snmp_h_set() function returns the new value of an SNMP MIB variable 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 the value |
value | value of name |
When the snmp_h_set() function fails to set the PATROL SNMP MIB variable it can return the NULL and set the PSL errno to one of the following values:
errno Value | Description |
---|---|
0 | E_PSL_NO_ERROR
|
95 | E_PSL_TIMEOUT |
96 | E_PSL_BAD_FUNCTION_PARAMETER
|
93 | E_PSL_NO_SUCH_ID
|
100 | E_PSL_SNMP_ERROR |
error message
When the snmp_h_set() function fails to set the PATROL SNMP MIB variable because of an invalid objectid the following message is returned:
There is no such variable name in this MIB.
Example
The following example uses the snmp_h_set() function to set a value in the PATROL MIB:
snmp_h_set(myhost,MIBaddr . " " . newtype . " " . newvalue);
}