Enhance Unifi Wireless Client count for multiple VAPs #4794

Merged
merged 3 commits into from Oct 14, 2016

Projects

None yet

4 participants

@jquagga
Contributor
jquagga commented Oct 14, 2016

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

The proposed patch below enhances the original unifi wifi client polling. The original code only works properly if on Virtual Access Point is configured on the router. If more than one exists, the existing commit code takes the first two 2.4ghz AP clients as the 2.4 and the 5 ghz total client count. That's not what we want.

This code snmpwalk's all of the VAPs for their client and their band. Then we if the band is ng, add it to wirelessclients1. If not, it's on wirelessclients2.

I've also added a check in the initial if statement to make sure this unifi device is wireless. Otherwise it shouldn't have any wireless clients.

Two issues to note at the moment. One is that ./scripts/pre-commit.php is throwing errors on the VlanFunctionsTest. I'm not sure what's causing that or if it is related to this patch. I didn't think it was touching anything vlan related.

The other issue is that comparing the unifi controller (the Unifi management software) and the snmpwalk results, the snmpwalk is adding 1 additional client to the results. I think that's a Unifi bug and I'm going to discuss that with Ubiquiti. This code is reporting the total reported from snmpwalk happily and graphing those totals.

@murrant

Looks good, might be a little neater to use snmpwalk_cache_oid, but this is fine.

@laf laf merged commit 098dc69 into librenms:master Oct 14, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@scrutinizer-notifier

The inspection completed: No new issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment