Skip to main content
Version: Next

SNMP

SNMPv2c SET sink connector

Description

The SNMP sink writes each input row to one SNMP agent by sending one synchronous SNMPv2c SET request. The V1 scope is deliberately limited to SET operations. It does not send traps or informs, and it does not support SNMPv1 or SNMPv3.

Every row supplies a numeric OID, a string value, and an SMI value type. The corresponding field names are configurable. The default mapping consumes the oid, value, and value_type fields emitted by the SNMP source; additional fields such as agent and poll_time are ignored by the sink.

Support Those Engines

Spark
Flink
SeaTunnel Zeta

Key Features

Supported DataSource Info

The connector uses SNMP4J and supports SNMPv2c agents reachable over UDP.

DatasourceSupported VersionsDependency
SNMP agentSNMPv2cDownload

Sink Options

NameTypeRequiredDefaultDescription
hostStringYes-SNMP agent host name or IP address. Do not include a protocol or port.
portIntNo161SNMP agent UDP port.
communityStringYes-SNMPv2c community credential. The connector does not write this value to its logs or errors.
timeout_millisLongNo5000Timeout in milliseconds for each SET request attempt.
retriesIntNo1Number of retries after the initial SET request attempt. A value of 0 sends one attempt.
oid_fieldStringNooidInput STRING field containing the numeric OID to set.
value_fieldStringNovalueInput STRING field containing the value to set.
value_type_fieldStringNovalue_typeInput STRING field containing the SMI value type.
common-optionsNo-Common Sink Options, including plugin_input.

Factory option validation checks nonblank strings, the port range, a positive timeout, and nonnegative retries before sink construction. The three mapped fields must exist in the input schema, must use STRING, and must refer to distinct fields. Schema errors are rejected while the job is created. Null values and blank OID or value-type fields are rejected before a network request is sent. The value field is validated according to its SMI type; an empty OctetString or OctetStringHex is valid, and text OctetString whitespace is preserved.

Supported SMI Value Types

The value_type comparison is case-insensitive and ignores whitespace, _, and - characters. The sink accepts both the documented names and SNMP4J syntax strings emitted by the SNMP source, including Counter, Gauge, OCTET STRING, and OBJECT IDENTIFIER.

Value typeAccepted value
Integer32 or IntegerSigned 32-bit decimal integer.
UnsignedInteger32 or UnsignedIntegerDecimal integer from 0 through 4294967295.
Counter32 or CounterDecimal integer from 0 through 4294967295.
Gauge32 or GaugeDecimal integer from 0 through 4294967295.
TimeTicksDecimal count of hundredths of a second from 0 through 4294967295, or the SNMP4J source format [days, ]hours:mm:ss.hh.
Counter64Decimal integer from 0 through 18446744073709551615.
OctetString or OCTET STRINGUTF-8 text represented by the input string.
OctetStringHexAn even number of hexadecimal characters, such as 00ff10.
OID or OBJECT IDENTIFIERNumeric object identifier. Leading dots are accepted.
IpAddressDotted IPv4 address.

OctetString is a textual mapping. Use OctetStringHex when byte-for-byte binary content is required.

Example

env {
parallelism = 1
job.mode = "BATCH"
}

source {
FakeSource {
plugin_output = "snmp_updates"
schema = {
fields {
oid = string
value = string
value_type = string
}
}
rows = [
{
kind = INSERT
fields = {
oid = "1.3.6.1.2.1.1.5.0"
value = "router-1"
value_type = "OctetString"
}
}
]
}
}

sink {
SNMP {
plugin_input = "snmp_updates"
host = "192.0.2.10"
port = 161
community = "replace-with-your-community"
timeout_millis = 3000
retries = 1
}
}

Replace the placeholder community before running the example. Supply the real credential outside checked-in job files. community is automatically masked when the parsed job configuration is logged. There is no need to add it to shade.options for log masking; that option also participates in configuration shading/encryption.

Delivery, Failure, and Security Behavior

  • One successful write call means the agent returned a successful SNMP response for that row.
  • A timeout after all configured attempts or a non-zero SNMP response error status fails the sink task.
  • A row can block for approximately timeout_millis * (retries + 1) before it fails. Keep this below the job's checkpoint timeout.
  • SNMP4J retransmits a timed-out request. A late response can therefore make a non-idempotent OID observe the same SET more than once.
  • The sink has no transactional commit protocol or recoverable writer state. Engine recovery can repeat a SET request, so delivery is at-least-once.
  • Parallel writers can update the same OID out of order. Use parallelism 1 when update order matters.
  • Row kinds are not interpreted as CDC operations. Every input row, including update or delete row kinds, is treated as a SET request.
  • Treat community as a credential. Supply it through configuration substitution or another secret-management path, and do not place a real value in job files committed to source control.
  • SNMPv2c provides no wire encryption or integrity protection. The community and SET payload are sent in cleartext; use only a trusted private network or a protected tunnel such as a VPN.
  • Traps, informs, SNMPv1, and SNMPv3 are outside this V1 contract.

See Common Sink Options for options such as plugin_input.

Change Log
ChangeCommitVersion
[Feature][Connector-V2] Add SNMPv2c polling source connector-Next
[Feature][Connector-V2] Add SNMPv2c SET sink connector-Next