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.
https://grafana.com/docs/grafana/latest/installation/debian/
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.
https://github.com/unifi-poller/unifi-poller/wiki/InfluxDB
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.
https://github.com/unifi-poller/unifi-poller/wiki/Installation
Sixth: Configure UniFi-Poller
Now that you have installed UniFi-Poller, you need to configure it to work with your UniFi Controller.
https://github.com/unifi-poller/unifi-poller/wiki/Configuration
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 save_dpi |
Sites | 11311 | 10414 | …enabled save_sites |
USW | 11312 | 10417 | …have UniFi Switches |
USG | 11313 | 10416 | …have UniFi Gateways |
UAP | 11314 | 10415 | …have UniFi Access Points |
Clients | 11315 | 10418 | …love nano |
Ninth: Wait…
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.
April 17, 2020 at 4:01 am
Is this doable on a Raspberry Pi? I have several lying around, and this might be a good project for one of them.
April 18, 2020 at 11:50 am
Yes. The VM I am running mine on only has 1GB of RAM.
April 22, 2020 at 5:53 am
Is this doable on a Raspberry Pi? I have several lying around, and this might be a good project for one of them.
April 23, 2020 at 4:49 am
Hi Dave,
So I went ahead and built the entire setup on a Pi 4; however, I am not getting any data into Grafana. The only error I am seeing is this: Apr 22 13:40:47 raspberrypi unifi-poller[2193]: 2020/04/22 13:40:47 [ERROR] metric fetch for InfluxDB failed: re-authenticating to https://127.0.0.1:8443: unifi controller: Get https://127.0.0.1:8443/: dial tcp 127.0.0.1:8443: connect: connection refused. Do you happen to have an idea what I did wrong?
April 23, 2020 at 10:59 pm
I’m trying to troubleshoot this. If I do a “sudo net stat -anop tcp | grep 844” on the Pi, there are no results, thus it doesn’t appear that anything is listening on 8443. I guess that means that somewhere sown the line I misconfigured something. Now, to find it.
April 24, 2020 at 5:50 am
Found the issue. This error is related to uni-poller. You have to put in the url, username, and password for your unified controller in up.conf. Once I did that, everything works great. I also learned that if you want DPI stats, it has to be enabled on the controller and in the up.conf file.
June 29, 2020 at 9:52 am
I’m having the same issue. Where is the up.conf file?
Thanks
June 30, 2020 at 11:22 am
Morning. It housed be in the same folder that UniFi poller has been installed.
unifi-poller\up.conf
June 11, 2021 at 7:09 am
Hi,
I ran into this issue as well. I did enter this in the up.conf:
[unifi.defaults]
url = “https://<>:8443”
user = “<>”
pass = “<>”
What am I missing? It might be that I didn’t add the new user to the site. I couldn’t find the option to invite an admin to a site on my UDM pro.
February 25, 2021 at 6:35 pm
Yes, it will run on a Pi 4, but Influxdb is not terribly well performing on the default Rasbian 32 bit kernel, and Unifi-Poller in particular causes Influxdb to consume >100 CPU constantly, and also to go into endless compaction cycles.
I ended up moving unifi poller and influxdb to 64 bit Ubuntu on an Intel box.
July 10, 2020 at 12:10 am
Thanks for this! I installed on my Pi and mostly works but some of the stock dashboards show panels with ‘panel plugin not found’: Table-old, natel-discrete-panel to name a couple. Any thoughts?
July 12, 2020 at 8:18 pm
Not sure. As I said I didn’t built this. Best to post on the GitHub it comes from.
July 27, 2020 at 7:07 pm
The tl;dr is that the panels were created in Grafana 7 and you’re running Grafana 6. If you upgrade Grafana you wont have this issue. The other option is to edit the dashboard panels after import and select “table” where it says “table-old”.
July 27, 2020 at 7:04 pm
Very Cool. Thanks!
August 10, 2020 at 11:39 pm
Okay just to be clear I have to have two ubuntu servers? I have completed installing Zabbix, I am confused as to why I need another server running, lots of servers just to look at some pretty graphs lol.
February 26, 2021 at 7:17 am
I run it all in Docker on a single server. Check the unifi-poller wiki.
August 19, 2020 at 1:47 pm
Hey, hopefully I might be able to find some answers here. I went with the InfluxDB, Grafana, UniFi-poller running on a new instance in AWS Lightsail, and pulling UniFi information from another Lightsail instance. Works well, everything is displaying properly but have had no luck in getting Grafana to display current internet bandwidth being used in a “live” way. I got 30 down and 10-ish up (third world country, speeds are terrible generally speaking) and I want to be able to see through Grafana how much of those 30/10 are being used live. Any help?
February 25, 2021 at 6:30 pm
I am unclear how Zabbix contributes to this?
July 26, 2022 at 9:09 pm
Guys I am willing and able to pay someone to set this up for me please
Can someone send me a Facebook message on shane Hood or Hood electrical or email on shane@hoodelectrical.com
Greatly appreciated