|
|
|
|
- SNMP tables
- OID de columnas
Lee un tabla de valores SNMP. Una tabla de valores SNMP es una array bidimensional de cadenas. // 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
Sintaxis
<Result> = SNMPGetTable(<Session identifier> , <SNMP table OID> , <WLanguage array>)
<Result>: booleano - True si se realizó la lectura,
- False si se produce un error. ErrorInfo devuelve más información sobre el error.
<Session identifier>: Integro Identificador de la sesión SNMP, devuelto por Sesión de inicio SNMPS. <SNMP table OID>: Cadena de caracteres Identificador de SNMP tabla para leer. Esta cadena puede corresponder al identificador en formato numérico o en formato de texto (el archivo MIB que describe el OID debe haber sido cargado por SNMPLoadMIB). <WLanguage array>: Array variable (array bidimensional de cuerdas) Cuando se ejecuta la función, este WLanguage array se asigna con los valores del SNMP tabla. Las filas son los elementos de la tabla (de 1 al número total de elementos). Las columnas son los atributos (del 1 al número de atributos de tabla). Por ejemplo: [ 2, 3] es el valor del atributo #3 del 2º elemento tabla. Observaciones En SNMP, las tablas tienen el siguiente formato: | | <OID Tabla SNMP>.1.<OID Columna 1>.<Índice Fila 1> | Valor 1.1 | <OID Tabla SNMP>.1.<OID Columna 1>.<Índice Fila 2> | Valor 2.1 | <OID Tabla SNMP>.1.<OId Columna 1>.<Índice Fila n> | Valor n,1 | <OID Tabla SNMP>.1.<OID Columna 2>.<Índice Fila 1> | Valor 1.2 | <OID Tabla SNMP>.1.<OID Columna 2>.<Índice Fila 2> | Valor 2.2 | <OID Tabla SNMP>.1.<OID Columna 2>.<Índice Fila n> | Valor n,2 | ... | | <OID Tabla SNMP>.1.<OID Columna m>.<Índice Fila 1> | Valor 1,m | <OID Tabla SNMP>.1.<OID Columna m>.<Índice Fila 2> | Valor 2,m | <OID Tabla SNMP>.1.<OID Columna m>.<Índice Fila n> | Valor n,m | SNMPGetTable devuelve el tabla en el siguiente formato: | | | | | | Columna 1 de OID | Columna 2 de OID | ... | Columna OID m | Índice fila 1 | Valor 1.1 | Valor 1.2 | | Valor 1,m | Índice fila 2 | Valor 2,1 | Valor 2,2 | | Valor 2,m | ... | | | | | Índice fila n | Valor n,1 | Valor n,2 | | Valor n, m |
Se recomienda definir constantes para el OID de las columnas (véase el ejemplo).
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|