|
|
|
|
- SNMP tables
- OID of columns
SNMPGetTable (Function) In french: SNMPLitTableau Reads a table of SNMP values. A table of SNMP values is a two-dimensional array of strings. // Read the storage devices of local system SessionID is int = SNMPStartSession("127.0.0.1", "public") Â // OID constants for the table of devices OIDHRSTORAGETABLE = "1.3.6.1.2.1.25.2.3" // Number of the relevant columns in the SNMP table of devices OIDHRSTORAGETYPE = 2 OIDHRSTORAGEDESCR = 3 OIDHRSTORAGESIZE = 5 OIDHRSTORAGEUSED = 6 Â sDeviceTable is array of 0 by 0 string SNMPGetTable(SessionID, OIDHRSTORAGETABLE, sDeviceTable) // To read the StorageSize and StorageUsed values only // SNMPGetTable(SessionID, OIDHRSTORAGETABLE, ... // sTableDevices, [OIDHRSTORAGESIZE, OIDHRSTORAGEUSED]) Â // Number of rows nNumberRows is int = ArrayInfo(sDeviceTable, tiNumberRows) Â FOR i = 1 TO nNumberRows Trace("Device " + i) Trace("Type " = sDeviceTable[i, OIDHRSTORAGETYPE]) Trace("Description " = sDeviceTable[i, OIDHRSTORAGEDESCR]) Trace("Size " = sDeviceTable[i, OIDHRSTORAGESIZE]) Trace("Used " = sDeviceTable[i, OIDHRSTORAGEUSED]) Trace(" ") END Syntax
<Result> = SNMPGetTable(<Session identifier> , <SNMP table OID> , <WLanguage array>)
<Result>: Boolean - True if the reading was performed,
- False if an error occurs. ErrorInfo returns more information on the error.
<Session identifier>: Integer Identifier of SNMP session, returned by SNMPStartSession. <SNMP table OID>: Character string Identifier of SNMP table 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). <WLanguage array>: Array variable (two-dimensional array of strings) When the function is run, this WLanguage array is assigned with the values of the SNMP table. The rows are the elements of the table (from 1 to the total number of elements). The columns are the attributes (from 1 to the number of table attributes). For example: <WLanguage Array> [2, 3] is the value of attribute #3 of 2nd table element. Remarks In SNMP, the tables have the following format: | | <SNMP Table OID>.1.<Column 1 OID>.<Index Row 1> | Value 1,1 | <SNMP Table OID>.1.<Column 1 OID>.<Index Row 2> | Value 2,1 | <SNMP Table OID>.1.<Column 1 OID>.<Index Row n> | Value n,1 | <SNMP Table OID>.1.<Column 2 OID>.<Index Row 1> | Value 1,2 | <SNMP Table OID>.1.<Column 2 OID>.<Index Row 2> | Value 2,2 | <SNMP Table OID>.1.<Column 2 OID>.<Index Row n> | Value n,2 | ... | | <SNMP Table OID>.1.<Column m OID>.<Index Row 1> | Value 1,m | <SNMP Table OID>.1.<Column m OID>.<Index Row 2> | Value 2,m | <SNMP Table OID>.1.<Column m OID>.<Index Row n> | Value n,m | SNMPGetTable returns the table in the following format: | | | | | | OID column 1 | OID column 2 | ... | OID column m | Index row 1 | Value 1,1 | Value 1,2 | | Value 1,m | Index row 2 | Value 2,1 | Value 2,2 | | Value 2,m | ... | | | | | Index row n | Value n,1 | Value n,2 | | Value n, m |
We recommend that you define constants for the OID of columns (see the example).
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|