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="<[10.0.1.1:public:.1.3.6.1.2.1.2.2.1.10.1:10000]" }
Number WiFiOutOctets "Wifi OUT Octets [%d]" <network> (Network){ snmp="<[10.0.1.1:public:.1.3.6.1.2.1.2.2.1.16.1:10000]" }
Number WiFiIFSpeed "Wifi IF Speed [%d]" <network> (Network) { snmp="<[10.0.1.1:public:.1.3.6.1.2.1.2.2.1.5.1:10000]" }
Number EthernetInOctets "Ethernet IN Octets [%d]" <network> (Network) { snmp="<[10.0.1.1:public:.1.3.6.1.2.1.2.2.1.10.2:10000]" }
Number EthernetOutOctets "Ethernet OUT Octets [%d]" <network> (Network){ snmp="<[10.0.1.1:public:.1.3.6.1.2.1.2.2.1.16.2:10000]" }
Number EthernetIFSpeed "Ethernet IF Speed [%d]" <network> (Network) { snmp="<[10.0.1.1:public:.1.3.6.1.2.1.2.2.1.5.2:10000]" }
However, the log file is filling up with these messages:
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).
Thank you for your response. The configuration looks like this:
################################ SNMP Binding #########################################
#
# Listening Port (optional, defaults to '162')
snmp:port=162
# The SNMP community to listen to (optional, defaults to 'public')
snmp:community=public
# The SNMP retry timeout (in milliseconds). Defaults to 1500.
# Sets the number of milliseconds between retries.
snmp:timeout=1500
# The SNMP number of retries. Defaults to 0.
# Sets the number of retries before aborting the request.
snmp:retries=1
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.
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.
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
too.
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).
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?
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
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 ?