SNMP Binding not working

Hi openHAB community

I used to have the SNMP binding working and monitoring toner levels on my printer, but after a complete system loss and new build, I cannot get it to work at all. Using the log viewer, I get this result:

SNMP service not initialized, can’t send GET[requestID=0, errorStatus=Success(0), errorIndex=0, VBS[1.3.6.1.2.1.43.12.1.1.4.1.1 = Null]] to CommunityTarget[address=192.168.1.20/1162,version=0,timeout=1500,retries=2,securityLevel=1,securityModel=1,securityName=public,preferredTransports=null]

This is for the SNMP Version 1, and the error shows “Version=0”. If I change the Thing to SNMP V2c, the error persists but the log changes to “Version=1”.

I’m using port 1162 as advised by earlier posts from many years ago.

When I run SNMPGET from the terminal, the results are as they should be:

iso.3.6.1.2.1.43.12.1.1.4.1.1 = STRING: “Black”

I’m running openHAB on docker so to rule out issues with that, did a fresh install of openHAB on a Debian box and exactly the same thing happens.

Any ideas?

perhaps these articles may help

https://serverfault.com/questions/1022957/iptables-redirecting-inbound-udp-to-a-different-port-and-response-going-out-th

in order to use a different port you have to do a few tweaks but basically

this is the tldr answer

# iptables -t nat -A OUTPUT --src 0/0 --dst 1.2.3.4 -p udp --dport 162 -j DNAT --to-destination 1.2.3.4:1162

this is also covered here as well.

Thanks @justaoldman but I’m not trying to receive traps, just standard status. I’d only changed ports etc. to rule out anything! Anyway, after removing all of the Things and re-creating them on the Debian box, it started working fine; still can’t get it to work on OH in Docker.

There’s a Home Assistant binding for Samsung SyncThru which is the printer I’m trying to query so I spun up an HA container and that worked fine, but I don’t want to use HA just to get status into OH.

More searching found some snmp2mqtt gateways and the one I now have working in Docker is GitHub - dchesterton/snmp2mqtt: Expose SNMP sensors to MQTT so now using that and pulling into OH from there.

If anyone has SNMP working for a Docker instance of openHAB, let me know :slight_smile:

Hi,

You did not say what version of OH you are running but this discussion may be relevant to you as well.