I am a sucker for a pretty graph, and it is something I have spent countless hours working on. And for the most part my go-to stack is Zabbix and Grafana, though I have recently been working with InfluxDB to achieve a bunch of different stuff. And recently I came along UniFi Poller https://github.com/unifi-poller/unifi-poller.
I didn’t create this, and the credit doesn’t go to me. I have just put a guide together celebrating their great work.
UniFi poller pulls metrics directly from the UniFi Controller and saves it to InfluxDB which can then be pulled into Grafana for some beautiful graphs.
Install is pretty easy, and works a range of different platforms, I generally use Ubuntu for me, and in this case Ubuntu 1804, so my guide will be based around that. I’ll do a few URL’s to the guides I have followed, google is your friend here if you need to find for a different platform… why re-invent the wheel, and I am not going to pretend I am smart enough to build all of this. Credit goes to the URL’s listed and the authors there.
First: Setup Ubuntu with LAMP
For any Ubuntu Server I use that runs a web based service I install the LAMP Stack, Digital Ocean have a great guide for it, along with many others.
Second: Install Zabbix
Once again our friends at Digital Ocean have provided a great guide for this.
Third: Install Grafana
Grafana is the easiest platform in the world to install. Their own site has a bulletproof guide.
Fourth: Install InfluxDB
InfluxDB like Grafana is really easy to install, granted there are a few more steps with UniFi Poller, but in this part.
echo "deb https://repos.influxdata.com/ubuntu bionic stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
sudo apt -y update
sudo apt install -y influxdb
sudo systemctl start influxdb
Fifth: Install UniFi-Poller
These commands work for Ubuntu 1804, if you are using a different system check the Wiki on setting up UniFi Poller.
Sixth: Configure UniFi-Poller
Now that you have installed UniFi-Poller, you need to configure it to work with your UniFi Controller.
Seventh: Configure UniFi Controller
Add a user to the UniFi Controller. After logging into your controller:
Go to Settings -> Admins
Add a read-only user (unifipoller) with a nice long password.
The new user needs access to each site. For each UniFi Site you want to poll, add admin via the ‘Invite existing admin’ option.
Take note of this info, you need to put it into the unifi-poller config file in a moment.
Eighth: Import poller dashboards
Simply click the + on the left nav bar in Grafana and click Import.
Put in the ID for the dashboard (below) and click the blue Load button.
Select the InfluxDB or Prometheus data source you created previously.
Click the Green Import button on the last screen.
Repeat this for each dashboard you want.
The IDs for each database platform are below, use them.
You only need Prometheus or Influx, not both. Unless you really want both.
|App||Prometheus ID||Influx ID||Get this if you…|
|Client DPI||11310||10419||…enabled |
|USW||11312||10417||…have UniFi Switches|
|USG||11313||10416||…have UniFi Gateways|
|UAP||11314||10415||…have UniFi Access Points|
The poller saves the data from the controller to InfluxDB, though it doesn’t pull in the historical data, InfluxDB pulls via UniFi Poller into the its own database so at first it may look like it hasn’t worked.
So this is not the be end and all guide, I am not the one who created all this amazing work, credit goes to those on the links provided. I am simply a huge fan and was asked by some to show how I achieved it.