SNMPTransport
Represents SNMP Transport functionality. Objects of this class are typically obtained from nodes that support SNMP. Objects of this class used to access SNMP data form node.
Instance attributes
- snmpVersion: String
-
SNMP version used by the transport. Can be "1", "2c", "3", "Default" or "Unknown"
Instance methods
- get(oid) ⇒ SNMPVarBind
-
Get the object value from specific node with SNMP GET request. The node and all SNMP communication details defined by SNMP transport. Returns SNMPVarBind object, or, if
oidis an array, an array of SNMPVarBind objects in the same order (all OIDs are sent in one request). Will return null on failure, on invalid OID, or if the agent returned an error.Table 1. Parameters oid
String or Array
SNMP object id, or array of up to 64 object ids. Can be given with or without leading dot.
- getValue(oid, codepage): String
-
Get the object value from specific node with SNMP GET request. The node and all SNMP communication details defined by SNMP transport. This function is similar to SNMPGet but returns string instead of an SNMPVarBind object. Will return null on failure.
Table 2. Parameters oid
String
SNMP object id. Can be given with or without leading dot.
codepage
String
Optional. Code page used to decode string values. Default code page is used if omitted or
null.println($node.createSNMPTransport()?.getValue("1.3.6.1.2.1.1.2.0")); // Will print e.g. 1.3.6.1.4.1.14988.1
- getValues(array, codepage): Array
-
Get object values from specific node with SNMP GET request. Request will contain all values that are provided in array. The node and all SNMP communication details defined by SNMP transport.
Table 3. Parameters array
Array
Array with SNMP object ids to get (only the first 64 are used)
codepage
String
Optional. Code page used to decode string values. Default code page is used if omitted or
null.ReturnArray with value strings in the same order as the requested object ids, or
nullifarrayis empty, contains an invalid OID, or the request failed.
- set(oid, value, dataType): bool
-
Assign a specific value to the given SNMP object for the node. The node and all SNMP communication details defined by SNMP transport. Will return
trueon success,falsein case of failure.Table 4. Parameters oid
String
SNMP object id. Can be given with or without leading dot.
value
String or ByteStream
Value to assign to oid.
dataType
String
SNMP data type (optional, case-insensitive). Octet string is used if omitted or not recognized.
- walk(oid): Array
-
Get an array of the SNMPVarBind from specific node with SNMP WALK request. The node and all SNMP communication details defined by SNMP transport. Will return null on failure.
Table 5. Parameters oid
String
SNMP object id. Can be given with or without leading dot.
Constants
| Description | Value |
|---|---|
Integer. |
INTEGER |
Same as INTEGER. |
INT |
Octet string. |
STRING |
Object id. |
OID |
IP address. |
IPADDR |
Same as IPADDR. |
IP ADDRESS |
32-bit counter. |
COUNTER32 |
32-bit unsigned integer. |
GAUGE32 |
Timeticks. |
TIMETICKS |
64-bit counter. |
COUNTER64 |
32-bit unsigned integer. |
UINTEGER32 |
Same as UINTEGER32. |
UINT32 |
Same as STRING. |
OCTET STRING |
Same as OID. |
OBJECT IDENTIFIER |
64-bit integer. |
INTEGER64 |
64-bit unsigned integer. |
UINTEGER64 |
Floating point number. |
FLOAT |
Double precision floating point number. |
DOUBLE |
Bit string. |
BIT STRING |
Opaque. |
OPAQUE |
NSAP address. |
NSAP ADDRESS |
Sequence. |
SEQUENCE |
Null. |
NULL |