Unifi is a well-known wireless solution developed by Ubiquity Networks. It’s widely used due to its efficiency and low cost.
Up until some years ago, the vendor offered just a basic set of access points managed by a software controller. Year after year, the number and types of wireless controllers grew to include many specialized types (internal, external, long range, wide coverage, etc.)The software controller has become much more sophisticated and can now control not just Wireless Access Points, but also Security Gateways, LAN Switches and Cameras. The controller collects a lot of interesting information and metrics in its local MongoDB: this data can be accessed via web console.
With a centralized monitoring solution like NetEye, it would be great to integrate the metrics collected by the Unifi Network Controller.
One nice project is available on GitHub: davidnewhall/unifi-poller: it’s an agent which collects your Unifi client and device data and send it to InfluxDB. This way, the metrics can be duplicated in NetEye’s InfluxDB, available to build up any Grafana dashboard you can imagine.
To build a unifi-poller agent into NetEye, several steps are required.
Detailed instructions for building code on NetEye 4 are available on GitHub:
First of all, the project has to be cloned locally:
git clone https://github.com/davidnewhall/unifi-poller
Next, a working Google Go complier is required:
From within Go, four additional Libraries must be installed:
go get github.com/golift/unifi
go get github.com/influxdata/influxdb1-client/v2
go get github.com/naoina/toml
go get github.com/ogier/pflag
At this point you can change to the unifi-poller local path, and a simple make command will build the executable.
I advise you to keep the default paths for unify-poller components:
The configuration file is self-explanatory: you need to configure the access URL and credentials for the Unifi Network Controller, the polling period and the Influx Database name (the name unifiis recommended).
The project doesn’t provide an initdaemon startup script for the unifi-poller: however, I’ve attached an example one to this blog.
The last step before starting the unifi-poller daemon is to create a brand-new influx Database!
Within NetEye, create the new Influx database with proper data retention:
CREATE DATABASE unifi WITH DURATION 90d
Now you can start the daemon. If everything is OK, it will log some basic statistics in /var/log/unifi-poller.log:
[INFO] Logged Unifi States. Clients: 80 – Wireless APs: 9 Gateways: 0 Switches: 3
The unifi-poller project provides a few Grafana dashboards that can be directly imported into NetEye.
Of course, the Dashboards can be customized and integrated with metrics coming from other systems.
Here is the basic Insights dashboard:
And a deeper wireless analysis:
Also, here is wireless channel distribution, divided by Vendor:
A lot of metrics are collected. I urge you to take a deeper look at InfluxDB to find the most interesting ones.
Nice article! You can install unifi-poller with Travis-CI built binary packages on Linux now. A deb and an rpm package are available on the GitHub Releases page and should work on any Debian or RHEL distro. This should make it a lot easier to get up and going. If you’re running a mac, a home-brew formula is available for you. And if none of that suits your fancy, check out the Docker image available on Docker Cloud. https://github.com/davidnewhall/unifi-poller/wiki/Docker
Have a wonderful day!