ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / SNMP Protocol functions
  • SNMP tables
  • OID of columns
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
SNMPGetTable (Function)
In french: SNMPLitTableau
Reads a table of SNMP values.
A table of SNMP values is a two-dimensional array of strings.
Example
// 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

SNMP tables

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 1OID column 2...OID column m
Index row 1Value 1,1Value 1,2Value 1,m
Index row 2Value 2,1Value 2,2Value 2,m
...
Index row nValue n,1Value n,2Value n, m

OID of columns

We recommend that you define constants for the OID of columns (see the example).
Component: wd290com.dll
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/03/2023

Send a report | Local help