|
|
|
|
SNMPGet (Function) In french: SNMPLit Reads one or more values of an agent with which an SNMP session was started. // Read the description of the local system SessionID is int = SNMPStartSession("127.0.0.1", "public") nType is int sDesc is string = SNMPGet(SessionID, ".1.3.6.1.2.1.1.1", nType)
// Read the description of the local system by using the MIB file SessionID is int = SNMPStartSession("127.0.0.1", "public") nType is int SNMPLoadMIB("c:\windows\system32\mib_ii.mib") sDesc is string = SNMPGet(SessionID, "iso.org.dod.internet.mgmt.mib-2.system.sysDescr", nType)
Syntax
Reading a value of an agent Hide the details
<Result> = SNMPGet(<Session identifier> , <OID to read> [, <Returned type>])
<Result>: ANSI character string - Value of the OID returned by the agent. The type of the value is retrieved in an integer variable (<Returned Type>).
- Empty string ("") if an error occurred.
<Session identifier>: Integer Identifier of SNMP session, returned by SNMPStartSession. <OID to read>: Character string Identifier of the SNMP object to read. This string can correspond to the identifier in numeric format or in text format (the MIB file that describes the OID must have been loaded by SNMPLoadMIB). <Returned type>: Optional Integer variable If this parameter is specified, the variable will be assigned with the type of the retrieved value. The following constants are available: | | snmpTypeBits | The OID contains bits. | snmpTypeCounter32 | The OID is a counter (signed integer on 32 bits). | snmpTypeCounter64 | The OID is a counter (signed integer on 64 bits). | snmpTypeInteger | The OID contains an integer. | snmpTypeIPAddress | The OID contains an IP address. | snmpTypeNull | The OID is not associated with a value (a branch with child elements but without value by itself for example). | snmpTypeOID | The OID contains an OID. | snmpTypeOpaque | The OID contains a value that cannot be interpreted directly. | snmpTypeProgressBar | The OID contains a progress bar. | snmpTypeString | The OID contains a string. | snmpTypeTicks | The OID contains a number of ticks. | snmpTypeUnsignedInteger | The OID contains an unsigned integer. |
Reading several values of an agent Hide the details
<Result> = SNMPGet(<Session identifier> , <Array of OIDs to read> , <Array of returned types> , <Array of returned values>)
<Result>: Boolean - True if all the values have been returned,
- False if at least one error occurred.
<Session identifier>: Integer Identifier of SNMP session, returned by SNMPStartSession. <Array of OIDs to read>: Array variable Array of strings containing the OIDs to read. Each OID can correspond to the identifier in numeric format or in text format (the MIB file that describes the OID must have been loaded by SNMPLoadMIB). <Array of returned types>: Array variable Array of integers. At least one dimension of this array must be equal to <Array of OIDs to Read>. Once the function has been run, this array will contains the types of the returned values.
The following constants are available: | | snmpTypeBits | The OID contains bits. | snmpTypeCounter32 | The OID is a counter (signed integer on 32 bits). | snmpTypeCounter64 | The OID is a counter (signed integer on 64 bits). | snmpTypeInteger | The OID contains an integer. | snmpTypeIPAddress | The OID contains an IP address. | snmpTypeNull | The OID is not associated with a value (a branch with child elements but without value by itself for example). | snmpTypeOID | The OID contains an OID. | snmpTypeOpaque | The OID contains a value that cannot be interpreted directly. | snmpTypeProgressBar | The OID contains a progress bar. | snmpTypeString | The OID contains a string. | snmpTypeTicks | The OID contains a number of ticks. | snmpTypeUnsignedInteger | The OID contains an unsigned integer. |
<Array of returned values>: Array variable Array of strings. At least one dimension of this array must be equal to <Array of OIDs to Read>. Once the function has been run, this aray will contain the values returned by the SNMP agent.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|