SNMP bandwidth monitor using statistics

Maybe installing some device inline that does support SNMP.

Iā€™ve contacted Ubiquiti to understand why they arenā€™t supporting SNMP on the UDR, but havenā€™t received a reply yet.

You can actually SSH into the UDR and install SNMP, according to some websites I found. Itā€™s ā€œjustā€ a Linux system, after all. That said, I havenā€™t done it myself and you may void your warranty or right to any support from them.

Thanks, yeah I did read something similar but wasnā€™t sure. Iā€™ll look into it and see how I go
Thanks again for the reply

Hi Jim,

I have an UDR, Iā€™m wondering if these sensors should work for me as well. Frankly, Iā€™ve never used snmp, I am not aware of the basics either. For example I donā€™t know if the baseoids are generic, thy are the same for each router, or they are unique. If they are unique, where can I find the ones that work for my UDR?

Is it enough if I just enable snmp, or shall I also grant access rights?

Sorry for the very junior questions and thank you in advance.

Regards,
Zoli

SNMP is not available on the UDR. Good luck getting info out of Ubiquiti: theyā€™re not saying why it isnā€™t supported or whether itā€™s on a roadmap.

Hm. You are right. The setting was available, but only for my AP, not for my UDR. First time I thought, that itā€™s applicable for each device. :frowning:

Take a look at this: Installing snmpd on Ubiquity Dream Machine Pro - Brandon Checketts

I was able to install SNMPD on my UDR but didnā€™t have time to look for correct baseoid.

2 Likes

Im trying to create a bandwidth monitor for my omada setup. Ran snmpwalk to output the following:

IF-MIB::ifDescr.1025 = STRING: default/lo
IF-MIB::ifDescr.1026 = STRING: default/eth0
IF-MIB::ifDescr.1027 = STRING: default/ip6tnl0
IF-MIB::ifDescr.1028 = STRING: default/sit0
IF-MIB::ifDescr.1029 = STRING: default/gre0
IF-MIB::ifDescr.1030 = STRING: default/gretap0
IF-MIB::ifDescr.1031 = STRING: default/bond0
IF-MIB::ifDescr.1032 = STRING: default/veth0
IF-MIB::ifDescr.1034 = STRING: default/eth1
IF-MIB::ifDescr.1038 = STRING: default/br-lan
IF-MIB::ifDescr.1039 = STRING: default/eth1.4094
IF-MIB::ifDescr.2049 = STRING: vnet/lo
IF-MIB::ifDescr.2050 = STRING: vnet/ip6tnl0
IF-MIB::ifDescr.2051 = STRING: vnet/sit0
IF-MIB::ifDescr.2052 = STRING: vnet/gre0
IF-MIB::ifDescr.2053 = STRING: vnet/gretap0
IF-MIB::ifDescr.2057 = STRING: vnet/veth1
IF-MIB::ifDescr.2059 = STRING: vnet/eth0.1
IF-MIB::ifDescr.2060 = STRING: vnet/eth0.77
IF-MIB::ifDescr.2061 = STRING: vnet/eth0.69
IF-MIB::ifType.1025 = INTEGER: softwareLoopback(24)
IF-MIB::ifType.1026 = INTEGER: ethernetCsmacd(6)

I figure that 1026 is the WAN, 2059-2061 are my VLANs based on snmpwalk. Based on this post, I would use 1.3.6.1.2.1.2.2.1.10.xxxx for Rx and 1.3.6.1.2.1.2.2.1.16.xxxx for Tx.

The user in that post stated:

to get a measurement that you can use you need to get the delta of two measurements divided by the seconds that the measuremants where apart from each other.

Anyone know the template sensor to do this?

You need a derivative for that. Check my earlier post describing the sensor hierarchy that I used.

Thanks, tried out your sensor heirarchy, but the values donā€™t seem to correspond with my activity. I can confirm that .10 and .16 are ā€œifInOctetsā€ and ā€œifOutOctetsā€ but the values always stay under 1Mbps. Iā€™ve tried these sensors for 1038 (br-lan) and 2059 (eth0.1) also.

Also looked at this guide from TP-Link: How to check the link status and data traffic statistics of TP-Link Business Routers with SNMP

The yaml I used:

- platform: snmp
  name: "Omada Router Eth0 Down"
  host: 192.168.29.1
  community: public
  baseoid: 1.3.6.1.2.1.2.2.1.10.1026
  version: '1'
  accept_errors: true  
  state_class: total_increasing
  icon: mdi:cloud-download
  unit_of_measurement: "B"

- platform: snmp
  name: "Omada Router Eth0 Up"
  host: 192.168.29.1
  community: public
  baseoid: 1.3.6.1.2.1.2.2.1.16.1026
  version: '1'
  accept_errors: true  
  state_class: total_increasing
  icon: mdi:cloud-download
  unit_of_measurement: "B"

- platform: derivative
  # Calculate the throughput by sampling the SNMP sensor
  name: "Network - WAN Down Throughput - Bps"
  source: sensor.omada_router_eth0_down
  unit_time: s
  round: 2
  
- platform: derivative
  # Calculate the throughput by sampling the SNMP sensor
  name: "Network - WAN Up Throughput - Bps"
  source: sensor.omada_router_eth0_up
  unit_time: s
  round: 2  

- platform: template
  sensors:
     wan_down_throughput:
       unit_of_measurement: Mbps
       # Convert throughput derivative from Bps to Mbps
       value_template: "{{ ((states('sensor.network_wan_down_throughput_bps') | int) * 8 / 10**6) | round(1) }}"
       
     wan_up_throughput:
       unit_of_measurement: Mbps
       # Convert throughput derivative from Bps to Mbps
       value_template: "{{ ((states('sensor.network_wan_up_throughput_bps') | int) * 8 / 10**6) | round(1) }}"

If you poll those oidā€™s with snmpwalk, do you see increasing values that can be related to the current network usage?

yep, the actual values continue to go up. Based on the recordings from 9am today, it shows eth0 has received about 1.5 billion bytes, which is about 1.5gb of data?

Ok, the rest should work then. Do a speed test and see if the derivative jumps. During low network usage it will most likely stay below 1 Mbps.

it does now

https://community.ui.com/releases/UniFi-OS-Dream-Machines-4-0-3/90b24b90-8be8-4987-8d47-eb408eb07e45

Be careful with Unifi OS 4.0.3 and home assistant integrations. See this link

I was going to upgrade as well until I saw this.

1 Like

i do not use the integration - but this may help? -

https://community.ui.com/releases/UniFi-OS-Dream-Machines-4-0-3/90b24b90-8be8-4987-8d47-eb408eb07e45?page=17

Where can we find baseoids for the UniFi SNMP?

Interesting to note: v 4.x.x of the UDM-SE firmware has SNMP functionality enabled - no need to ssh in and install the packages manually any more, you can enable it via the console now

1 Like

Anyone get this working with UniFi OS 4.0.6? It should work in theory.

Yes