Musson Industrial's Embr-SNMP Module (BETA)

Embr-SNMP (BETA)

Stability Warning

This module is still in beta, and therefore breaking configuration changes may occur between now and the final release. Use at your own risk.

This thread is for discussion related to Musson Industrial's Embr-SNMP module.

Embr-SNMP provides a set of OPC UA device drivers for SNMPv1, SNMPv2c, and SNMPv3.

Usage

  • Install the module.
  • Add your devices under OPC UA/Device Connections.
  • Point your tags at the OPC UA device using the OID as the Node ID.

Example (reading sysName)

ns=1;s=[MyDevice]1.3.6.1.2.1.1.5.0

Known Issues

Write Support

Write support is extremely basic; all writes occur as strings :man_shrugging:.


Downloads

Embr-SNMP-Ignition81-0.1.0.modl (2.3 MB)

8.3 soon: all the hard work is done, just need to cherry-pick some changes.
The module will support 8.1 -> 8.3 migration.

Any feedback related to SNMPv3 usage would be greatly appreciated.

5 Likes

Just installed this one, went straight to the V3 and configured a Mikrotik router as the SNMP host.
System immediately connected and tags came up. This was with SHA-1 and AES-128 on a private community.
Nice work.
When is the code going on GitHub? :smiley:

1 Like

So, just tested this one with an IPv6 host:

org.snmp4j.MessageException: Network is unreachable
at org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:680)
at org.snmp4j.Snmp.sendMessage(Snmp.java:1075)
at org.snmp4j.Snmp.send(Snmp.java:975)
at org.snmp4j.Snmp.send(Snmp.java:957)
at org.snmp4j.Snmp.send(Snmp.java:925)
at com.mussonindustrial.embr.snmp.devices.SnmpDeviceImpl.read(SnmpDeviceImpl.kt:100)
at com.mussonindustrial.embr.snmp.opc.OidAddressSpace.read(OidAddressSpace.kt:72)
at com.mussonindustrial.embr.snmp.opc.OidAddressSpace.read(OidAddressSpace.kt:42)
at org.eclipse.milo.opcua.sdk.server.util.SubscriptionModel$ScheduledUpdate.lambda$null$1(SubscriptionModel.java:170)
at org.eclipse.milo.opcua.sdk.core.util.GroupMapCollate.lambda$groupMapCollate$3(GroupMapCollate.java:47)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.toArray(Unknown Source)
at org.eclipse.milo.opcua.sdk.core.util.GroupMapCollate.allOf(GroupMapCollate.java:77)
at org.eclipse.milo.opcua.sdk.core.util.GroupMapCollate.groupMapCollate(GroupMapCollate.java:68)
at org.eclipse.milo.opcua.sdk.server.util.SubscriptionModel$ScheduledUpdate.run(SubscriptionModel.java:156)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Network is unreachable
at java.base/sun.nio.ch.DatagramChannelImpl.send0(Native Method)
at java.base/sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(Unknown Source)
at java.base/sun.nio.ch.DatagramChannelImpl.send(Unknown Source)
at java.base/sun.nio.ch.DatagramChannelImpl.send(Unknown Source)
at java.base/sun.nio.ch.DatagramChannelImpl.blockingSend(Unknown Source)
at java.base/sun.nio.ch.DatagramSocketAdaptor.send(Unknown Source)
at java.base/java.net.DatagramSocket.send(Unknown Source)
at org.snmp4j.transport.DefaultUdpTransportMapping.sendMessage(DefaultUdpTransportMapping.java:128)
at org.snmp4j.transport.DefaultUdpTransportMapping.sendMessage(DefaultUdpTransportMapping.java:46)
at org.snmp4j.MessageDispatcherImpl.sendMessage(MessageDispatcherImpl.java:270)
at org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:657)
... 25 common frames omitted

:tada:

Do you have multiple SNMPv3 devices to test with? I haven’t been able to test that the authentication works for multiple SNMPv3 devices connected at the same time. SNMPv3 authoritative engine stuff is… interesting.

It’s currently under the feat/snmp-module branch.

1 Like

I have a few devices here, yes I will get another one connected.

1 Like

How are you specifying the IPv6 address? In theory this should “just work”.

Just the string containing the address including the colons, I have a feeling there could be a typical parsing error where the colon gets assumed to denote a port mumber.

What’s the host OS of the gateway?

So you are correct, there are some issues here, I cannot get two V3 connections to occur simultaneously.

By any chance, do the connections share the same username?

I tried with both the same username and different usernames, also the same auth and priv encryption as well as different. It also seems to not reset something, so if I delete the second connection, the first still stays disconnected. All I get is no response logs, even with TRACE level.

Funky, the USM is probably all kinds of messed up.

This seems relevant, saving for later:

Looks like we should be using a shared global Snmp object instead of creating one for each device.

OSX on docker.

I have a feeling this is actually an issue because docker doesn't have IPv6 support enabled by default. Also IPv6 addresses should work if added in the host field as:

[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]

Yeah that’ll do it, you’re getting a legitimate network error.

Do they not currently?

I will have to test with an IPv6 native install, there is chat on Stack Overflow suggesting the square brackets notation is necessary.

1 Like

Feature Requests:

Add tag address notation that changes the snmp method called:

ns=1;s=[MyDevice]get:1.3.6.1.2.1.1.5.0 snmpGet(1.3.6.1.2.1.1.5.0)
ns=1;s=[MyDevice]walk:1.3.6.1.2.1.1.5.0 snmpWalk(1.3.6.1.2.1.1.5.0) as a Json Document
ns=1;s=[MyDevice]table:1.3.6.1.2.1.1.5.0 tableUtils.getTable(1.3.6.1.2.1.1.5.0) as a Dataset Tag

On device creation or changed settings, perform a snmpWalk of the root node, and populate the browsable OIDs in the tag browser.

Upload MIB files to the gateway, and then you can use either symbolic names or OIDs. On tag creation or update, a symbolic name can be converted to the corresponding OID in the tag provider backend. Adding to this, the MIBs could be used to translate the browsable OIDs that match from the initial browse.

Add scripting functions into the module for manual event triggers.

1 Like

I’m definitely open to some table/tree helpers.

It would require some much smarter subscription management to be efficient, but it’s doable.

OPC drivers cannot deliver a dataset.

1 Like

20251004_151448

I got a second to test this afternoon, and I am able to connect to multiple SNMPv3 agents using 0.1.0.