Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors

SNMP

The SNMP Connector reads data from SNMP manager objects and writes data back to them, forwarding the results to ThingsBoard as device attributes and telemetry.

To enable this connector, add it to the connectors list in tb_gateway.json — see the General Configuration reference.

The connector reads its settings from a JSON file. Below is a full example with four device entries — the first using built-in converters, the second using a custom converter class, the third using SNMPv3 for both polling and traps, and the fourth configured for traps only, without polling:

{
"devices": [
{
"deviceName": "SNMP router",
"deviceType": "snmp",
"ip": "snmp.live.gambitcommunications.com",
"port": 161,
"pollPeriod": 5000,
"community": "public",
"attributes": [
{ "key": "ReceivedFromGet", "method": "get", "oid": "1.3.6.1.2.1.1.1.0", "timeout": 6 },
{ "key": "ReceivedFromMultiGet", "method": "multiget", "oid": ["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"], "timeout": 6 },
{ "key": "ReceivedFromGetNext", "method": "getnext", "oid": "1.3.6.1.2.1.1.1.0", "timeout": 6 },
{ "key": "ReceivedFromMultiWalk", "method": "multiwalk", "oid": ["1.3.6.1.2.1.1.1.0","1.3.6.0.1.2.1"] },
{ "key": "ReceivedFromBulkWalk", "method": "bulkwalk", "oid": ["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"] },
{
"key": "ReceivedFromBulkGet",
"method": "bulkget",
"scalarOid": ["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"],
"repeatingOid": ["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"],
"maxListSize": 10
}
],
"telemetry": [
{ "key": "ReceivedFromWalk", "community": "private", "method": "walk", "oid": "1.3.6.1.2.1.1.1.0" },
{ "key": "ReceivedFromTable", "method": "table", "oid": "1.3.6.1.2.1.1" }
],
"attributeUpdateRequests": [
{ "attributeFilter": "dataToSet", "method": "set", "oid": "1.3.6.1.2.1.1.1.0", "type": "INTEGER" },
{ "attributeFilter": "dataToMultiSet", "method": "multiset", "mappings": { "1.2.3": "10", "2.3.4": "${attribute}" }, "type": "OCTETSTRING" }

An array of device configurations. Each entry represents one SNMP manager device.

Parameter Default Description
deviceName SNMP router Device name in ThingsBoard
deviceType snmp Device type in ThingsBoard
ip IP address or hostname of the SNMP manager
port 161 SNMP port
pollPeriod 10000 Polling interval in milliseconds
timeout 6 Timeout of one request attempt in seconds
retries 10 Total number of attempts for each request, including the first one
version v2c SNMP version: v1, v2c, or v3
community Default SNMP community string (public or private); required for SNMPv1 and SNMPv2c
security SNMPv3 security settings; required when version is v3 — see Subsection “security”
converter (Optional) Custom converter class name; omit to use the built-in converter
attributes Array of attribute mappings — see below
telemetry Array of telemetry mappings — see below
attributeUpdateRequests (Optional) Array of attribute-write configurations
serverSideRpcRequests (Optional) Array of RPC-triggered SNMP operation configurations

If the device does not respond within timeout, the gateway sends the request again, up to retries attempts in total, so one request can take up to timeout × retries seconds. Each entry can override both values — see Supported methods.

The gateway skips an SNMPv1 or SNMPv2c device without community, and an SNMPv3 device whose security is missing or has an invalid format. If the credentials do not match the device, the gateway does not skip it but cannot read data from it.

Required for SNMPv3 devices. SNMPv3 uses the User-based Security Model (USM). The security level is defined by the parameters you set: only username for noAuthNoPriv, plus authentication for authNoPriv, plus privacy (encryption) for authPriv. The same settings are used for polling, attribute updates, RPC requests, and checking traps from the device.

Parameter Description
username USM user name
authProtocol (Optional) Authentication protocol: MD5 or SHA (SHA-1)
authKey Authentication passphrase, at least 8 characters; required when authProtocol is set
privProtocol (Optional) Privacy protocol: DES or AES (AES-128); requires authProtocol
privKey Privacy passphrase, at least 8 characters; required when privProtocol is set
contextName (Optional) Name of the context to read from, if the device provides data in several contexts, for example, for several virtual instances
contextEngineId (Optional) Engine ID of that context as a hex string, for example, 80001f8880e1; needed only if the context and device engine IDs are not the same, for example, behind an SNMP proxy

Messages are neither authenticated nor encrypted.

"security": {
"username": "noAuthUser"
}

username, authKey, and privKey support placeholders in the ${VARIABLE_NAME} format. This allows you to keep passphrases out of the configuration file and pass them as environment variables instead:

"security": {
"username": "privUser",
"authProtocol": "SHA",
"authKey": "${SNMP_AUTH_KEY}",
"privProtocol": "AES",
"privKey": "${SNMP_PRIV_KEY}"
}

Sections “attributes” and “telemetry”

Section titled “Sections “attributes” and “telemetry””

Both sections share the same field structure. attributes entries are sent to ThingsBoard as device attributes; telemetry entries are sent as time-series telemetry.

Parameter Description
key ThingsBoard attribute or telemetry key name
method SNMP operation to use — see Supported methods
oid Manager object identifier (string or array, depending on the method)
community (Optional) Community string for this entry; overrides the device community (SNMPv1 and SNMPv2c only; IoT Gateway v.3.8.7 and later)

Method parameters, such as timeout, retries, scalarOid, and valueOid, are described in Supported methods.

Configurations in this section are optional. ThingsBoard allows the provision of device attributes and fetches some of them from the device application. You can treat this as a remote configuration for devices. Your devices are able to request shared attributes from ThingsBoard. See user guide for more details.

The “attributeUpdateRequests” configuration allows configuring the format of the corresponding attribute request and response messages.

Parameter Description
attributeFilter Shared attribute name to subscribe to
method SNMP write method: set or multiset
oid Object identifier to write to (used with set)
mappings OID-to-value map (used with multiset); values may reference ${attribute}
type SNMP data type for value encoding (see Supported data types) — required only for set and multiset methods
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
"attributeUpdateRequests": [
{
"attributeFilter": "dataToSet",
"method": "set",
"oid": "1.3.6.1.2.1.1.1.0",
"type": "INTEGER",
"timeout": 1,
"retries": 3
},
{
"attributeFilter": "dataToMultiSet",
"method": "multiset",
"mappings": {
"1.2.3": "10",
"2.3.4": "${attribute}"
},
"type": "OCTETSTRING"
}
]

The gateway waits for the result for up to timeout × retries seconds, but no longer than 5 seconds.

ThingsBoard allows sending RPC commands to the device connected to ThingsBoard directly or via Gateway.

Configuration, provided in this section is used for sending RPC requests from ThingsBoard to the device through the gateway.

Parameter Description
requestFilter RPC method name to bind
method SNMP operation to perform, except trap — see Supported methods
oid Object identifier (string or array, depending on the method)
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used

The gateway always replies to ThingsBoard: {"result": <value>} on success or {"error": "<message>"} on failure.

The gateway waits for the result for up to timeout × retries seconds, but no longer than 5 seconds.

The connector also has built-in get and set RPC methods that read or write any OID without configuration. See the Reserved RPC methods guide.

"serverSideRpcRequests": [
{
"requestFilter": "setData",
"method": "set",
"oid": "1.3.6.1.2.1.1.1.0",
"type": "IPADDRESS"
},
{
"requestFilter": "dataToMultiSet",
"method": "multiset",
"mappings": [
{
"oid": "1.3.6.1.2.1.1.9.0",
"value": "44"
},
{
"oid": "1.3.6.1.2.1.1.10.0",
"type": "INTEGER",
"value": "${params.temperature}"
},
{
"oid": "1.3.6.1.2.1.1.11.0",
"type": "GAUGE",
"value": "${params.pressure}"
}
],
"type": "INTEGER"
},
{
"requestFilter": "dataToMultiSetBroadcast",
"method": "multiset",
"mappings": [
{
"oid": "1.3.6.1.2.1.1.12.0",
"value": "${params}"
},
{
"oid": "1.3.6.1.2.1.1.13.0",
"value": "${params}"
}
],
"type": "INTEGER"
},
{
"requestFilter": "getData",
"method": "get",
"oid": "1.3.6.1.2.1.1.1.0",
"timeout": 1,
"retries": 3
},
{
"requestFilter": "runBulkWalk",
"method": "bulkwalk",
"oid": ["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"]
}
]

Optional. Configures the UDP listener that receives SNMP traps from devices. The listener starts only when at least one device has a trap entry. If this section is omitted, the listener starts with the default address and port.

Parameter Default Description
address 0.0.0.0 Local IP address to listen on; 0.0.0.0 listens on all network interfaces
port 162 Port to listen on
"trapListener": {
"address": "0.0.0.0",
"port": 162
}
Method Operation Accepts array OID Extra parameters
get Read a single object No timeout, retries
multiget Read multiple objects in one request Yes timeout, retries
getnext Read the next object after the given OID No timeout, retries
walk Walk the subtree rooted at OID No timeout, retries
multiwalk Walk multiple subtrees Yes timeout, retries
bulkwalk Walk multiple subtrees using BULK requests Yes timeout, retries
table Read an SNMP table No timeout, retries
bulkget Read scalars and repeating objects in one BULK request — scalarOid, repeatingOid, maxListSize, timeout, retries
trap Receive a value from SNMP traps sent by the device No valueOid
set Write a value to a single object No type, timeout, retries
multiset Write values to multiple objects — mappings, type, timeout, retries

Reads a single SNMP object.

Parameter Description
oid Object identifier to read
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"key": "ReceivedFromGet",
"method": "get",
"oid": "1.3.6.1.2.1.1.1.0",
"timeout": 6,
"retries": 3
}

Reads multiple SNMP objects in a single request.

Parameter Description
oid Array of object identifiers to read
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"key": "ReceivedFromMultiGet",
"method": "multiget",
"oid": [
"1.3.6.1.2.1.1.1.0",
"1.3.6.1.2.1.1.2.0"
],
"timeout": 6
}

Reads the next object in the MIB tree after the given OID.

Parameter Description
oid Starting OID
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"key": "ReceivedFromGetNext",
"method": "getnext",
"oid": "1.3.6.1.2.1.1.1.0",
"timeout": 6
}

Traverses the subtree rooted at the given OID. The method may send several requests; timeout and retries apply to each of them.

Parameter Description
oid Root OID for the walk
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"key": "ReceivedFromWalk",
"method": "walk",
"oid": "1.3.6.1.2.1.1.1.0"
}

Traverses multiple subtrees in a single operation. The method may send several requests; timeout and retries apply to each of them.

Parameter Description
oid Array of root OIDs to walk
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"key": "ReceivedFromMultiWalk",
"method": "multiwalk",
"oid": [
"1.3.6.1.2.1.1.1.0",
"1.3.6.0.1.2.1"
]
}

Walks multiple subtrees using SNMP BULK requests (more efficient than multiwalk for large trees). The method may send several requests; timeout and retries apply to each of them.

Parameter Description
oid Array of root OIDs to walk
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"key": "ReceivedFromBulkWalk",
"method": "bulkwalk",
"oid": [
"1.3.6.1.2.1.1.1.0",
"1.3.6.1.2.1.1.2.0"
]
}

Reads a full SNMP table. The method may send several requests; timeout and retries apply to each of them.

Parameter Description
oid OID of the table root
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"key": "ReceivedFromTable",
"method": "table",
"oid": "1.3.6.1.2.1.1"
}

Reads scalar and repeating objects in a single SNMP BULK request.

Parameter Description
scalarOid Array of non-repeating (scalar) OIDs
repeatingOid Array of repeating OIDs
maxListSize Maximum number of repetitions to return
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"key": "ReceivedFromBulkGet",
"method": "bulkget",
"scalarOid": [
"1.3.6.1.2.1.1.1.0",
"1.3.6.1.2.1.1.2.0"
],
"repeatingOid": [
"1.3.6.1.2.1.1.1.0",
"1.3.6.1.2.1.1.2.0"
],
"maxListSize": 10
}

Receives a value from SNMP traps sent by the device instead of polling it. Used only in attributes and telemetry. Traps are received by the trap listener and processed as soon as they arrive. A device that only receives traps does not need port and pollPeriod.

Parameter Description
oid Trap OID (the value of snmpTrapOID.0)
valueOid (Optional) OID of the trap variable to use as the value; a variable matches when its OID equals valueOid or starts with it; if omitted, all trap variables are sent as a JSON object
[
{
"key": "ReceivedFromTrapWithValueOid",
"method": "trap",
"oid": "1.3.6.1.6.3.1.1.5.3",
"valueOid": "1.3.6.1.2.1.2.2.1.1"
},
{
"key": "ReceivedFromTrap",
"method": "trap",
"oid": "1.3.6.1.6.3.1.1.5.3"
}
]

A trap is assigned to the entry when it is sent from the device ip and its OID matches the entry oid.

SNMPv1 traps have no trap OID, so the gateway builds it from the trap fields. Set oid as for other SNMP versions, for example, 1.3.6.1.6.3.1.1.5.3 for linkDown, and use <enterprise OID>.0.<specific trap number> for enterprise-specific traps. The gateway also adds the agent address (1.3.6.1.6.3.18.1.3.0, snmpTrapAddress.0) and the enterprise OID (1.3.6.1.6.3.1.1.4.3.0, snmpTrapEnterprise.0) to the SNMPv1 trap variables, so they can also be selected with valueOid.

The trap must use the device credentials — community for SNMPv1 and SNMPv2c (the entry’s own community, if set), or security for SNMPv3 — otherwise it is ignored.

Writes a value to a single SNMP object. Used in attributeUpdateRequests and serverSideRpcRequests.

Parameter Description
oid Object identifier to write to
type SNMP data type for value encoding, default OCTETSTRING — see Supported data types
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"attributeFilter": "dataToSet",
"method": "set",
"oid": "1.3.6.1.2.1.1.1.0",
"type": "GAUGE"
}

Writes values to multiple SNMP objects in a single operation. The shape of mappings depends on where the method is used.

In attributeUpdateRequests — mappings is an object mapping OIDs directly to values:

Parameter Description
mappings Object mapping OIDs to values; values may use ${attribute} to reference the incoming attribute value
type SNMP data type for value encoding, default OCTETSTRING — see Supported data types
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"attributeFilter": "dataToMultiSet",
"method": "multiset",
"mappings": {
"1.2.3": "10",
"2.3.4": "${attribute}"
},
"type": "COUNTER"
}

In serverSideRpcRequests — mappings is an array of objects, each with its own oid and value, and an optional per-mapping type override:

Parameter Description
mappings Array of { oid, value, type } objects
mappings[].oid Object identifier to write to
mappings[].value Value to write to the OID; use a JSON-path expression to extract data packed in the RPC call’s params object, or just a constant value
mappings[].type (Optional) Per-mapping SNMP data type override — see Supported data types
type Default SNMP data type applied to mappings that don’t specify their own type, default OCTETSTRING — see Supported data types
timeout (Optional) Timeout of one request attempt in seconds; if omitted, the device timeout is used
retries (Optional) Total number of request attempts; if omitted, the device retries is used
{
"requestFilter": "dataToMultiSet",
"method": "multiset",
"mappings": [
{
"oid": "1.3.6.1.2.1.1.9.0",
"value": "62"
},
{
"oid": "1.3.6.1.2.1.1.10.0",
"type": "INTEGER",
"value": "${params.temperature}"
},
{
"oid": "1.3.6.1.2.1.1.11.0",
"type": "GAUGE",
"value": "${params.pressure}"
}
],
"type": "INTEGER"
}
Type Description Example
INTEGER Whole number (positive or negative) 42, -100
COUNTER Non-negative integer that monotonically increases until reaching 4,294,967,295, then wraps to zero 1500
COUNTER64 64-bit non-negative integer that monotonically increases until reaching 18,446,744,073,709,551,615, then wraps to zero 9223372036854775807
GAUGE Non-negative integer for gauges and measurements that can increase or decrease 75
TIMETICKS Time value in units of 0.01 seconds (hundredths of a second) 12345678
OCTETSTRING String of bytes (octets) "hello"
IPADDRESS IPv4 address in dotted-decimal notation "192.168.1.1"