If you use a Ubiquiti Unifi Router, you can provide better data than what is in the Unifi Dashboard using Unpoller. Unpoller is a lightweight program to collect data from the Unifi controller and summarize that data using the open source Grafana analytics and visualization web based application. Unpoller is a docker application consisting of three Docker containers which include an Influx database, the Grafana analytics app, and the Unpoller application.
To install Docker:
sudo apt install curl
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker $(whoami)
newgrp docker
groups
Install Docker-Compose
sudo apt install docker-compose
Create application folders:
mkdir docker
cd docker
mkdir grafana
mkdir influxdb
mkdir unpoller
Create docker-compose.yml file:
nano docker-compose.yml
Insert the following code:
version: "3"
services:
influxdb:
container_name: up_influxdb
restart: unless-stopped
image: influxdb:1.8
ports:
- '8086:8086'
volumes:
- /home/scott/docker/influxdb:/var/lib/influxdb
environment:
- INFLUXDB_DB=unifi
- INFLUXDB_ADMIN_USER=unifi
- INFLUXDB_ADMIN_PASSWORD=unifi
grafana:
container_name: up_grafana
image: grafana/grafana
restart: unless-stopped
user: 1000:1000
ports:
- '3000:3000'
volumes:
- /home/scott/docker/grafana:/var/lib/grafana
depends_on:
- influxdb
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_INSTALL_PLUGINS=grafana-clock-panel,natel-discrete-panel,grafana-piechart-panel
unifi-poller:
container_name: up-poller
restart: unless-stopped
image: golift/unifi-poller:latest
depends_on:
- influxdb
- grafana
volumes:
- /home/scott/docker/unpoller:/config
Modify the paths above on the left side of the colon in the volume sections and modify the influx database name, username and password to meet your needs.
cd unpoller
nano unifi-poller.conf
Insert this code in the unifi-poller.conf file:
[unifi.defaults]
url = "https://172.16.0.1"
user = "unpolleruser"
pass = "Mypassword1"
save_dpi = true
[influxdb]
url = "http://172.16.5.5:8086"
The first URL above should be the location of your Unifi controller address. The second URL should be the IP address of your docker host.
Be sure to create a user account on your Unifi device to match the configuration file above. You can of course name the account anything you want and set any password as long as it matches.
Test your application:
cd ..
docker-compose up
Any errors will be in the two configuration files.
Now go to: http://your-docker-host:3000
Log in with admin/admin and change your password.
Choose Configuratiion on the left hand side, then “Data Sources”. “Add data source”, choose InfluxDB then fill in the details of the URL:
http://your-docker-address:8086
Include the Influx details: (database – unifi, User – unifi, Password – unifi), then Save & Test.
Finally, go to the Plus “+” sign and choose import and import the dashboard ID’s 10414, 10415, 10416, 10417, 10418 and 10419.
You should now be up and running!
Last, do a CTRL-C in the terminal to get out of docker-compose and then:
docker-compose up -d