Difference between revisions of "NXSL:SNMPGet"

From NetXMS Wiki
Jump to navigation Jump to search
Line 20: Line 20:
== Return Value ==
== Return Value ==


Object of class [[NXSL:SNMP_VarBind|SNMP_VarBind]] or null on failure.
Object of class [[NXSL:SNMP_VarBind|SNMP_VarBind]] or '''NULL''' on failure.


== Examples ==
== Examples ==

Revision as of 10:01, 22 October 2014

Get the object value from specific node with SNMP GET request. The node and all SNMP communication details defined by SNMP transport.

Since: 1.2.1

Syntax

SNMPGet(transport,oid);


Parameters

transport SNMP_Transport SNMP transport object.
oid SNMP object id.

Return Value

Object of class SNMP_VarBind or NULL on failure.

Examples

transport = CreateSNMPTransport(FindObject("MYWORKPC"));    // Create SNMP transport for node MYWORKPC
if (transport == null)
    return -1; // Failed to create SNMP transport, exit
oid = ".1.3.6.1.2.1.25.1.6.0";	// number of running processes
varbind = SNMPGet(transport, oid);
if (varbind == null)
    return -2; // Failed to issue SNMP GET request to MYWORKPC, exit
else
    trace(1, "SNMP GET ".varbind->name."=".varbind->value);