UniFi Poller – Amazing!

Ramblings of an IT Guy in Education

UniFi Poller – Amazing!

April 16, 2020 Infrastructure Monitoring Ubiquiti 14

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.

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04

Second: Install Zabbix

Once again our friends at Digital Ocean have provided a great guide for this.

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-zabbix-to-securely-monitor-remote-servers-on-ubuntu-18-04

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.

AppPrometheus IDInflux IDGet this if you…
Client DPI1131010419…enabled save_dpi
Sites1131110414…enabled save_sites
USW1131210417…have UniFi Switches
USG1131310416…have UniFi Gateways
UAP1131410415…have UniFi Access Points
Clients1131510418…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.

14 Responses

  1. Jon says:

    Is this doable on a Raspberry Pi? I have several lying around, and this might be a good project for one of them.

    • Dave Nichols says:

      Yes. The VM I am running mine on only has 1GB of RAM.

      • Jon says:

        Is this doable on a Raspberry Pi? I have several lying around, and this might be a good project for one of them.

      • Jon Irish says:

        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?

        • Jon Irish says:

          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.

          • JOn Irish says:

            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.

          • Bellows says:

            I’m having the same issue. Where is the up.conf file?

            Thanks

          • Dave Nichols says:

            Morning. It housed be in the same folder that UniFi poller has been installed.

            unifi-poller\up.conf

  2. Doug McConnell says:

    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?

    • Dave Nichols says:

      Not sure. As I said I didn’t built this. Best to post on the GitHub it comes from.

    • 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”.

  3. gary says:

    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.

  4. Dennys says:

    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?

Leave a Reply

Your email address will not be published. Required fields are marked *