Ubiquiti AC Gen 2 Mib update #4266

Closed
TyShawn76 opened this Issue Aug 30, 2016 · 35 comments

Projects

None yet

7 participants

@TyShawn76

Ubiquiti has updated their MIBs for their Gen 2 UAP devices. I was hoping to have the updated MIBs updated in Libre. I am including the information from UBNT in a beta forum.

http://community.ubnt.com/t5/UniFi-Wireless-Beta/Gen2-New-SNMP-MIB-Firmware/m-p/1606428#U1606428

Hi all,

I have a test firmware with improved SNMP MIB support. We added our own MIB to the already existing ones. This should provide significantly more information, especially about radio and BSS statistics. This is based on the upcoming 3.7.7 release, so should be pretty stable. Let us know if you find any issues!

The MIBs can be found here:
http://dl.ubnt-ut.com/snmp/UBNT-MIB
http://dl.ubnt-ut.com/snmp/UBNT-UniFi-MIB

This firmware is only for gen2 devices (UAP-AC-Lite/AC-LR/AC-Pro/AC-EDU)
http://dl.ubnt-ut.com/snmp/gen2-tinysnmp-3.7.x.bin | 0c8aa0e855455405ec8197b5e46c01fb

@Rosiak
Contributor
Rosiak commented Aug 30, 2016

Is this Beta? If so I think we should wait till an actual release.

@TyShawn76

Yes it's in beta at this moment.

@Rosiak
Contributor
Rosiak commented Aug 30, 2016

Don't get me wrong, but I don't think we should introduce support for something that is in a beta stage. But that's just my opinion.
@librenms/reviewers ?

@TyShawn76

I totally respect those views and if that's the direction then I can wait :). Is there a link or a guide I can look at if I want to try and get this working on my own for testing?

@Rosiak
Contributor
Rosiak commented Aug 30, 2016

You could maybe look at #721, but it's a fairly old commit just fyi.

@TyShawn76

Cool many thanks for your time and wisdom.

@laf
Member
laf commented Aug 30, 2016

I'd be happy to see it introduced personally.

@florianbeer
Contributor

Yes! That would be so incredibly handy. Especially channel utilization and number of connected clients per radio.

@Rosiak
Contributor
Rosiak commented Aug 31, 2016

@TyShawn76 Could you please post a snmpwalk with these new mibs loaded?

@TyShawn76

Can you check the forums for me please needed some info. Then I can supply you with the info you seek from me.

@TyShawn76
TyShawn76 commented Sep 1, 2016 edited
@TyShawn76 TyShawn76 closed this Sep 1, 2016
@murrant
Contributor
murrant commented Sep 1, 2016

You will need to snmpwalk . to include the vendor specific data.

@TyShawn76

I'm waiting on @Rosiak to help me with that output, unless you know the command I would need to provide that data.

@TyShawn76

Do these help at all?

I ran this command
snmpbulkwalk -v2c -c xxxxxxxx -OQUs -m UBNT-UniFi-MIB -M /opt/librenms/mibs udp:10.X.X.2:161 .
Timeout: No Response from udp:10.X.X.2:161

Then I ran.

snmpbulkwalk -v1 -c xxxxxxxxx -OQUs -m UBNT-MIB -M /opt/librenms/mibs udp:10.X.X.2:161 .
snmpbulkwalk: Cannot send V2 PDU on V1 session (Sub-id not found: (top) -> )

Archive.zip

@murrant murrant reopened this Sep 9, 2016
@jquagga
Contributor
jquagga commented Sep 26, 2016 edited

In case it helps, I ran the same snmpwalk command as @TyShawn76. However this is on a AC-Pro Gen 2 running the latest production firmware (it's no longer in beta).

Edit: Revise attachment with -m '[unifi mibs]'

snmpwalk-revised.txt

@ekoyle
Contributor
ekoyle commented Oct 3, 2016

From your snmpwalk output, it looks like these also use IEEE802dot11-MIB

@TyShawn76

It does look like its using that MIB as well.

@jquagga
Contributor
jquagga commented Oct 4, 2016

Here's a snmpwalk including the IEEE802dot11-MIB.
snmpwalk.txt

@TyShawn76

@jquagga Just to verify when you ran your poll you had three devices connected to your AP?

UBNT-UniFi-MIB::unifiVapNumStations.0 = INTEGER: 0
UBNT-UniFi-MIB::unifiVapNumStations.1 = INTEGER: 3

@jquagga
Contributor
jquagga commented Oct 4, 2016

Yep, 3 on 5Ghz, 0 on the 2.4.

The house has 3 APs. Usually only devices in the playroom connect to that AP. I had an iPhone and 2 laptops while polling.

The AP also has one device connected on the Secondary LAN port and bridged in, but thata not reported here I don't believe.

@TyShawn76

GREAT!! I wanted to verify I was looking at the right lines, what command did you run to get that output?

@jquagga
Contributor
jquagga commented Oct 5, 2016

The same as you except -m +ALL after adding the UBNT mibs and all of librenms's MIBs to my local SNMP directory. And I did a > snmpwalk.txt at the end to filter out the error messages and get a cleaner text file.

@jquagga
Contributor
jquagga commented Oct 11, 2016

I would imagine the desire here is to have full mib support the same way airfiber/airmax do. However, it is possible to configure the normal wifi poller to poll a couple of SNMP oids and get the client counts on the 2.4/5GHZ basestations.

I essentially re-purposed the code in the file for symbol devices and set it to poll unifi os's. This probably isn't usable without a conditional check. I would think if these oids return blank (as it would for unifi switches / routers / Gen1 UAPs) then this should be skipped.

diff --git a/includes/polling/wifi.inc.php b/includes/polling/wifi.inc.php
index 3159978..3d413b9 100644
--- a/includes/polling/wifi.inc.php
+++ b/includes/polling/wifi.inc.php
@@ -61,8 +61,18 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['ty
         $wificlients1 = snmp_get($device, '.1.3.6.1.4.1.388.11.2.4.2.100.10.1.18.1', '-Ovq', '""');

         echo (($wificlients1 + 0).' clients on wireless connector, ');
+    } else if ($device['os'] == 'unifi') {
+        echo 'Checking Unifi Wireless clients... ';
+
+        $wificlients1 = snmp_get($device, '.1.3.6.1.4.1.41112.1.6.1.2.1.8.0', '-Ovq', '""');
+        $wificlients2 = snmp_get($device, '.1.3.6.1.4.1.41112.1.6.1.2.1.8.1', '-Ovq', '""');
+
+        echo (($wificlients1 + 0).' clients on radio0, '.($wificlients2 + 0)." clients on radio1\n");
+
     }

+
+
     if (isset($wificlients1) && $wificlients1 != '') {
         $tags = array(
             'rrd_def'   => 'DS:wificlients:GAUGE:600:-273:1000',
@laf
Member
laf commented Oct 11, 2016

That's perfectly fine :) If you can submit a PR that would be ace.

@jquagga jquagga referenced this issue Oct 11, 2016
Merged

Unifi Wireless Client statistics #4772

2 of 2 tasks complete
@TyShawn76

Gen 1 APs also will return data it was added a couple of days after the Gen 2 info released.

@TyShawn76
TyShawn76 commented Oct 12, 2016 edited

Something is a little strange. On the UAP AC Pro I see the 2.4 band but nothing on the 5G. On my Lite I see both bands.

AC Pro
screen shot 2016-10-12 at 6 08 20 am

graph php

AC Lite
screen shot 2016-10-12 at 6 09 17 am

graph-1 php

@jquagga
Contributor
jquagga commented Oct 12, 2016

You have more than one SSiD configured correct? I determined after I put that code together it'll work for 1 SSID. If you have more than one, it needs more logic behind it. I was going to try and fix it if I have time

@jquagga
Contributor
jquagga commented Oct 12, 2016

So let me write down what I think would be the solution to this but it's beyond my ability to code.

Ubiquiti reports clients on a SSID/radio basis. The existing code assumed one VAP so .1.3.6.1.4.1.41112.1.6.1.2.1.8.0 is the 2.4ghz and .1.3.6.1.4.1.41112.1.6.1.2.1.8.1 is the 5Ghz. However if you have say two SSID, then .0 is 2.4ghz - SSID 1, and .1 is 2.4ghz - SSID 2. There would be a .2 and .3 which would have the 5ghz SSID 1 and SSID 2 entries. Unifi supports up to 4 SSID so that's 8 total oids (one for each band).

What I think could work is to snmpget .1.3.6.1.4.1.41112.1.6.1.2.1.9.$index which will have a value of "ng" or "na" (2.4 or 5ghz). Then assign the value of .1.3.6.1.4.1.41112.1.6.1.2.1.8.$index to either $wificlients1 or $wificlients2 depending on the value of 1.3.6.1.4.1.41112.1.6.1.2.1.9.$index. The .9 oid is the band, .8 is the number of clients.

@TyShawn76

Thats correct I have a main and guest network on the AC Pro.

@jquagga
Contributor
jquagga commented Oct 14, 2016

I have a pull request pending which should correct the client counts. #4794 I've also coded up the shell of mib parsing for the channel utilisation mib polling and graphing. I'm remote today but hopefully I can test that over the weekend and get a PR filed for that as well.

@jquagga
Contributor
jquagga commented Oct 17, 2016

Ok, so here's where I'm at now and probably need someone else's input. MIB polling of the Wireless Capacity works great. Graphing doesn't work through libreNMS and that's what I think I need some help working on.

This gist has the patch as I have it now. It's not ready for a PR since the graphing doesn't work in browser. However I believe from the poller output, the rrdfiles, and the graphs I generate outside of Librenms that the polling is working great. The patch adds the Unifi MIB, and polls it for 8 oids related to Wireless Capacity (Total, Used by Others, Self TX and Self RX) x 2 since there are two radios. I then try to generate two graphs, one per radio.

Manually with rrdtool I can generate this:

graph

That's generated by:

rrdtool graph 'graph1.png' \
--width '400' \
--height '100' \
--start end-1d \
-u 100 -l 0 -r \
'DEF:Others=ubnt-unifi-mib.rrd:Radio0OtherBss:LAST' \
'DEF:SelfRX=ubnt-unifi-mib.rrd:Radio0CuSelfRx:LAST' \
'DEF:SelfTX=ubnt-unifi-mib.rrd:Radio0CuSelfTx:LAST' \
'AREA:Others#FF3333:Others' \
'STACK:SelfRX#0066FF:SelfRX' \
'STACK:SelfTX#00FFFF:SelfTX'

And that looks about right from the data I'm getting from SNMP (yes, SelfTX is always tiny compared to RX on any band - not sure why that is).

I've tried two different ways to graph. RadioCU_0 is using essentially a modified graphing strategy from Airfiber. For RadioCU_1, I tried to use @murrant's generic_multi.inc.php but clearly I'm missing something. Neither graph generates in libreNMS.

@laf
Member
laf commented Oct 17, 2016

Best posting the debug output from the show rrdtool command in the webui for the graphs.

@jquagga
Contributor
jquagga commented Oct 17, 2016

Strangely when I do that, all I get is this strange square. I'm guessing that means rrdtool isn't called at all, but I'm not sure why.
screenshot

@murrant
Contributor
murrant commented Oct 17, 2016

This usually means there was a php error or something.

@jquagga jquagga referenced this issue Oct 17, 2016
Merged

UniFi Wireless MIB polling for Capacity #4816

2 of 2 tasks complete
@laf laf closed this in #4816 Oct 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment