Getting network use using SNMP - Error initializing binding


I’m trying to get network IN/OUT bandwidth usage displayed on the OpenHAB installation (Rasperry Pi). I’ve figured out that these items should give me the information I need to be able to calculate a rough estimate (using this formula) and the OIDs associated with ifInOctets, ifOutOctets and ifSpeed on my Airport Express.

Number WiFiInOctets "Wifi IN Octets [%d]" <network> (Network) { snmp="<[]" }
Number WiFiOutOctets "Wifi OUT Octets [%d]"  <network> (Network){ snmp="<[]" }
Number WiFiIFSpeed "Wifi IF Speed [%d]" <network>  (Network) { snmp="<[]" }

Number EthernetInOctets "Ethernet IN Octets [%d]"  <network> (Network) { snmp="<[]" }
Number EthernetOutOctets "Ethernet OUT Octets [%d]" <network>  (Network){ snmp="<[]" }
Number EthernetIFSpeed "Ethernet IF Speed [%d]"  <network> (Network) { snmp="<[]" }

However, the log file is filling up with these messages:

2015-12-13 15:04:20.288 [ERROR] [.o.b.snmp.internal.SnmpBinding] - SNMP: snmp not initialised - aborting request
2015-12-13 15:04:30.292 [ERROR] [.o.b.snmp.internal.SnmpBinding] - SNMP: snmp not initialised - aborting request
2015-12-13 15:04:30.296 [ERROR] [.o.b.snmp.internal.SnmpBinding] - SNMP: snmp not initialised - aborting request
2015-12-13 15:04:30.300 [ERROR] [.o.b.snmp.internal.SnmpBinding] - SNMP: snmp not initialised - aborting request
2015-12-13 15:04:30.303 [ERROR] [.o.b.snmp.internal.SnmpBinding] - SNMP: snmp not initialised - aborting request
2015-12-13 15:04:30.306 [ERROR] [.o.b.snmp.internal.SnmpBinding] - SNMP: snmp not initialised - aborting request
2015-12-13 15:04:30.309 [ERROR] [.o.b.snmp.internal.SnmpBinding] - SNMP: snmp not initialised - aborting request

and I get nothing displayed in the sitemap (no number that is, the icon and item names are displayed)

Any ideas? I appreciate all the help I can get on this.


How have you configured the binding? Does the permissions in the Pi allow you to use the port you’ve configured - this is often not the case as Linux locks down ports below 1024 (from memory).

Hi Chris,

Thank you for your response. The configuration looks like this:

################################ SNMP Binding #########################################
# Listening Port (optional, defaults to '162')

# The SNMP community to listen to (optional, defaults to 'public')

# The SNMP retry timeout (in milliseconds). Defaults to 1500.
# Sets the number of milliseconds between retries.

# The SNMP number of retries. Defaults to 0.
# Sets the number of retries before aborting the request.

Please note that the SNMP is not on the local linux box, but on an Airport Express. Thats why I thought the non-privileged port discussion in the manual did not apply…?

No - this still applies. The remote is obviously a remove (??), but the SNMP binding opens the port that you specify in your configuration (ie 162) so that it can communicate with the remote(s). So, if your Pi doesn’t allow this port to be opened, then it won’t work.

Try changing the port to something higher than 1024 and see if hat helps.

The binding UDP / TCP port 162 is for inbound SNMP traps.

Would be a nice addition to the binding if the SNMP trap port could be disabled as not everyone will need it and are happy to work with gets and sets only.

The outgoing SNMP requests will be on UDP port 161, if running on a linux build the easiest way to check that the outgoing message is generated would be to run a tcpdump.

tcpdump udp port 161

I used the snmptrapd to try to capture something (at all) from the device, and added this forward to the snmptrapd configuration:

disableAuthorization yes
forward default udp:

but that did not work. Any way of just forwarding connections made on

(or should it be

I tried using
sudo iptables -t nat -A PREROUTING -p tcp --dport 2048 -j DNAT --to
sudo iptables -A FORWARD -d -p tcp --dport 161 -j ACCEPT
sudo sysctl net.ipv4.ip_forward=1

but that did not do it (with snmp:port=2048).

Any ideas on how to get snmp requests sent by openhab on port 2048 redirected to (which is my router)?


Hello @Fredrik_Karlsson

Sorry for the late reply I have not been on for a few days. You should be forwarding the inbound 162 trap traffic, 161 is for outbound SNMP requests which should work without any translation / forwarding.

In my openhab.cfg SNMP section there is no configuration option for outbound SNMP port, therefore this should always be port 161, otherwise you would have to either reconfigure all receiving systems default SNMP port or translate all your outbound traffic, both of which is messy and unnecessary.

As I mentioned earlier it would be a nice feature for this binding if inbound traps could be disabled.

once you get the octets how does one convert it to KBps/MBps for display on the sitemap?

can you give an example of what you are receiving as data? items/sitemap etc

Frame label="Internet Speed" icon="network" {
	Text item=EthernetInOctets label="Internet Download [%df]" icon="network"		
	Text item=EthernetOutOctets label="Internet Upload [%df]" icon="network"		

Number EthernetInOctets “IN [%.1f]” { snmp="<[]" }
Number EthernetOutOctets “OUT [%.1f]” { snmp=">[]" }

which gives me 4259103375f in the widget instead of 45.5kbs or whatever that OID is… looking


Ok, I never got this to work myself. Glad to see you succeeded getting
anything out of a router this way I will certainly look into this myself
But what you get out of the OID is ontet NUMBER, not the number of ontets.
So, what you need to do is compare what you get with what you got the last
time you pulled the OID, then relate that to the time interval between the
two times and the interface speed (another OID).

Please have a look here:


Thread revival, I have been using the SNMP binding for some time, I have configured it to get the IN/OUT octets from a number of network devices which works but so far am not doing anything with the data apart from displaying on the screen.

What persistence would be best and how would I go about graphing the data?

Not sure about editing iptables, and the wiki wasn’t helpful.

I ended up getting SNMP working on a raspberry pi using authbind. The solution is based on this post (


  1. Install authbind
sudo apt-get install authbind
  1. Configure it to grant access to port 161.
sudo touch /etc/authbind/byport/161
sudo chmod 777 /etc/authbind/byport/161
  1. Start openhab via authbind specifying --deep argument:
authbind --deep /opt/openhab/

Hope that helps someone. or makes it to the wiki :sunglasses:

1 Like

SNMP Binging works on my openhab.b5 (binding-snmp1 - 1.9.0.b5) Windows 10
but does not work in openhab.last release (binding-snmp1 - 1.10.0.SNAPSHOT) CentOS

[ERROR] [ab.binding.snmp.internal.SnmpBinding] - SNMP: snmp not initialised - aborting request

have you fixed the permission issue mentioned above, for example like stated by @Steven_Conway ?

Yes, if I comment the string User=openhab, then SNMP binding works fine.
I’m doing something wrong… :slight_smile:

Description=Open Home Automation Bus

ExecStart=/usr/bin/authbind --deep /opt/openhab/current/
ExecStop=/usr/bin/kill -SIGINT $MAINPID


to me this looks like a permission issue. When you comment the User line, who is the owner of the openhab process ? Who is the owner when you uncomment it ?

root of course

what does

ls -l /etc/authbind/byport/

show ?

-rwxrwxrwx 1 openhab openhab 0 Feb 18 12:34 161