Ubiquiti Cloud Gateway Ultra (UCG-Ultra) Bandwidth Monitoring

It looks this device (and the UX) does not support SNMP. Is there any way to get live (or close to live) stats of the wan speed bandwidth?

The official Unifi network integration gives you rx and tx sensors for each client, but nothing for the WAN, unfortunately. I recently experimented with this and my UDR. You can probably make a template sensor that sums everything. I have no idea whether it will be accurate. I aborted the integration.

You can install SNMP, but from what I understand it will be gone after every update.

EDIT (2024-09-27): SNMP is in fact now part of the Unifi OS. I cannot recall the date now, but it was release earlier this year (2024).

I then discovered the pyunify Python library, so I’m looking to build a simple custom integration that provides only some WAN throughout data. It uses your gateway/router’s API and it seems you get updated data every 10-15 sec. This also means that the integration will need to poll.

If I can find the actual API call, then one can just make some REST sensors. One challenge here is that you need a logged in session, which is a separate call. This is why the integration might be easier.

I used to do this using an appdaemon app. You can get all info pyunifi provides. It works fine but if you poll more than 60sec interval it refuses connection. I posted on here a while ago, I’ll see if I can dig it out

https://community.home-assistant.io/t/unifi/556047

Do you have a github of your custom integration to follow for updates? It looks a very interesting project. Monitoring the WAN is just what is missing from the official one.

No yet. My post is literally from my research last night. :slight_smile: Soon… Baby at home, so things take time.

wish you all the best :slight_smile:

I use this for monitoring of my Unifi Env; Its based on the original work by @Holdestmade

Update: I have added in WAN tx/rx packets and bytes. There arent many other useful stats there tbh other than the most recently run speedtest but ive never found that accurate.

After having this running for nearly a day, ive setup utility meters that measure daily upload and daily download, and they fairly closely match the states my ISP gives me, so id say close enough is good enough.

1 Like

I would welcome this addition to the UniFi integration

As I dont use it for device tracking, I removed the unifi integration. I never really found it useful.

Instead, i use the appdaemon app I wrote to provide monitoring and statistics. At the time I wrote it I was having a specific issue with a network interface so i wanted ot keep an eye on the speed of a specific switch port.

If there is interest I could convert it into a custom integration. Most of the hard work is already done.

Good point.

I was considering the pyunifi library, because it’s super simple to work with.

from pyunifi.controller import Controller

client = Controller("unifi", "username", "password", 8443, "UDMP-unifiOS", "default", False)
device = client.get_device_stat(aps[2]['mac'])
device['stat']['gw']['wan-rx_bytes']
device['stat']['gw']['wan-tx_bytes']

I see the Unifi Network integration uses balloob/Paulus’ own library. I will need to delve into it to understand it better and first see if it supports what’s needed. I will also need to have my ducks in a row to contribute to a platinum status integration bundled with core.

A previous iteration of the library was based on Paulus design of the hue library.

You will of course get support. Don’t worry about that

1 Like

You don’t need to use the integration for device tracking. It’s configurable. I would much rather we consolidate the functionality to the integration than having four separate offerings. Let’s make a commitment to one good offering for the community.

With your appdaemon skills you could for sure do it in the integration as well

3 Likes

I noticed that in the newly released Unifi OS for Dream machines (4.0.3) they added SNMP. UCG-Ultra is yet to receive version 4 but hopefully, if they add SNMP, we will be able to get some metrics

1 Like

I really hope it will then come to the UDR too. I don’t see 'n any reason why not. :slight_smile:

Hello. Rx and TX for unifi device ports has been added with the 2024.5 beta UniFi Network integration - official thread - #135 by Robban

Does that resolve one of the features on this thread?

Thanks, Robban, I picked it up in the release notes and I’m planning on testing it. I’m a bit behind on admin though, because I’m spending some time on my back, but will try to test it as soon as I can. In the meantime, perhaps someone else will (too).

1 Like

Take your time!

I downloaded 2024.5, what do I need to do to have Rx/Tx for my Unifi devices? I have a UCG-Ultra and USW-Enterprise-8-POE.

I don’t see any new Rx and Tx numbers for my UCG-Ultra after the update :