ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / SNMP Protocol functions
  • SNMP tables
  • OID of columns
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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
// Lecture des périphériques de stockage du système local
IDSession is int = SNMPStartSession("127.0.0.1", "public")

// Constantes OID pour le tableau de périphériques
OIDHRSTORAGETABLE = "1.3.6.1.2.1.25.2.3"
// Numéro des colonnes intéressantes du tableau SNMP de périphériques
OIDHRSTORAGETYPE = 2
OIDHRSTORAGEDESCR = 3
OIDHRSTORAGESIZE = 5
OIDHRSTORAGEUSED = 6

sTablePeripheriques is array of 0 by 0 strings
SNMPGetTable(IDSession, OIDHRSTORAGETABLE, sTablePeripheriques)
// Pour ne lire que les valeurs StorageSize et StorageUsed
// SNMPLitTableau(IDSession, OIDHRSTORAGETABLE, ...
//				sTablePeripheriques, [OIDHRSTORAGESIZE, OIDHRSTORAGEUSED]) 

// Nombre de lignes
nNombreLignes is int = ArrayInfo(sTablePeripheriques, tiNumberRows)

FOR i = 1 TO nNombreLignes
	Trace("Périphérique " + i)
	Trace("Type " = sTablePeripheriques[i, OIDHRSTORAGETYPE])
	Trace("Description " = sTablePeripheriques[i, OIDHRSTORAGEDESCR])
	Trace("Taille " = sTablePeripheriques[i, OIDHRSTORAGESIZE])
	Trace("Utilisé " = sTablePeripheriques[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: <Tableau WLangage> [2,3] is the value of attribute 3 of the 2nd element of the array.
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: wd300com.dll
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/02/2025

Send a report | Local help