Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Latest commit

 

History

History
250 lines (200 loc) · 8.16 KB

Installation.md

File metadata and controls

250 lines (200 loc) · 8.16 KB

Upgrading

See the Updating wiki for upgrade details.

Prerequisites

Important: You need to create an Influx database, or setup Prometheus, and user/pass on the UniFi Controller. You also need Grafana and you have to add the Influx or Prometheus data source to Grafana. Do not skip any of the pre-reqs!

Click here to reveal the prerequisites for poller.

  1. Add a user to the UniFi Controller. After logging into your controller:
    1. Go to Settings -> Admins
    2. Add a read-only user (unifipoller) with a nice long password.
    3. The new user needs access to each site. For each UniFi Site you want to poll, add admin via the 'Invite existing admin' option.
    4. Take note of this info, you need to put it into the unifi-poller config file in a moment.
  2. You need InfluxDB OR You need Prometheus.
    • If you already have one of these, skip ahead to Grafana.
    • Using Docker? You can use the docker-compose file file to setup Poller, InfluxDB and Grafana all at once.
  3. If using Influx, Create a database in InfluxDB. Something like:
    influx -host localhost -port 8086
    CREATE DATABASE unifi
    USE unifi
    CREATE USER unifipoller WITH PASSWORD 'unifipoller' WITH ALL PRIVILEGES
    GRANT ALL ON unifi TO unifipoller
    Take note of the username and password you create (if you choose to do so, you may skip the last 2 commands). You'll need the hostname, port, database name, and optionally user/pass in a moment for the unifi-poller config file.
  4. If you're using Prometheus, see the Prometheus doc for post-install configuration.
  5. You need Grafana. After you follow the directions in Grafana Wiki, and before (or after) you install unifi-poller:

Docker

  • Check that you meet the pre-reqs above, or use Docker Compose to "do it all."
  • See the Docker wiki for information about installing poller.
  • Then see the Configuration doc for post-install configuration information.
  • Synology? Check out the Synology HOWTO provided by @Scyto.

FreeBSD

Poller is now available in the ports tree and can be installed from there.

Follow these directions to install poller using FreeBSD ports.

  • To install compiled binary from ports run:
pkg install net/unifi-poller
  • To build and install from ports run:
cd /usr/ports/net-mgmt/unifi-poller
make install clean
  • Use these commands to maintain the service:
# View manual.
man unifi-poller

# Edit config file.
# A defualt configuration file is placed in /usr/local/etc/unifi-poller/up.conf which is not overwritten on upgrades
# A sample configuration is placed in /usr/local/etc/unifi-poller/up.conf.sample
vi /usr/local/etc/unifi-poller/up.conf

# enable the service. Or edit /etc/rc.conf
sysrc unifi_poller_enable="YES"

# Start, Restart, Stop service.
service unifi-poller start
service unifi-poller restart
service unifi-poller stop
# Check service status, useful for scripts.
service unifi-poller status

# Logs should wind up in this file, but your syslog may differ.
grep unifi-poller /var/log/messages

Linux

JFrog Bintray provides package hosting with RedHat, CentOS, Debian and Ubuntu repos.

Follow these directions to configure the repo and install poller.

The same package is in all the repos, but you can set the name to match your OS as shown below.

RedHat variants (CentOS, Fedora)

  • Create a file at /etc/yum.repos.d/golift.repo with the following contents.
  • You may replace centos with el, but they're the same thing either way.
    [golift]
    name=Go Lift Awesomeness - Main Repo
    baseurl=https://dl.bintray.com/golift/centos/main/$basearch/
    gpgcheck=1
    repo_gpgcheck=1
    enabled=1
    sslverify=1
    gpgkey=https://golift.io/gpgkey
  • Then install the package: sudo yum install unifi-poller
  • You'll have to respond yes to the prompts to install the Go Lift GPG key.

Debian variants (Ubuntu, Knoppix)

  • Install the repo and package using the commands below.
  • Replace ubuntu with debian if you have Debian.
    curl -s https://golift.io/gpgkey | sudo apt-key add -
    echo deb https://dl.bintray.com/golift/ubuntu bionic main | sudo tee /etc/apt/sources.list.d/golift.list
    sudo apt update
    sudo apt install unifi-poller
  • Supported distributions:
    • xenial, bionic, focal, jesse, stretch, buster, bullseye
    • If you have another distro, try one of these ^ (they're all the same).

Linux: Post-Install

See the Configuration doc and the example config file for additional post-install configuration information.

  • Edit the config file after installing the package, and correct the authentication information for your setup:

    sudo nano /etc/unifi-poller/up.conf
    # or
    sudo vi /etc/unifi-poller/up.conf
  • Restart the service:

    sudo systemctl restart unifi-poller
  • Check the log:

    tail -f -n100  /var/log/syslog /var/log/messages | grep unifi-poller

macOS

Follow these instructions to install poller using Homebrew.

  1. Install Homebrew
  2. brew install golift/mugs/unifi-poller
  3. Edit the config file after installing the brew:
    nano /usr/local/etc/unifi-poller/up.conf
    # or
    vi /usr/local/etc/unifi-poller/up.conf
    • Correct the authentication information for your setup (see prerequisites).
  4. Start the service:
    # do not use sudo
    brew services start unifi-poller
    • The log file should show up at /usr/local/var/log/unifi-poller.log.
    • If it does not show up, make sure your user has permissions to create the file.
  5. This is how you restart it. Do this when you upgrade.:
    brew services restart unifi-poller

Manual Package

You can build your own package from source with the Makefile.

Recommend reading the note at the bottom if you're using a mac.
  1. Install FPM
  2. Install Go.
  3. Clone this repo and change your working directory to the checkout.
    git clone https://github.com/unifi-poller/unifi-poller.git
    cd unifi-poller
  4. Install local Golang dependencies:
  5. Build a package (or two!):
    1. make deb will build a Debian package.
    2. make rpm builds a RHEL package.
  6. Install it:
    1. sudo dpkg -i *.deb || sudo rpm -Uvh *.rpm

Manual Build Notes

If you're building linux packages on a mac you can run brew install rpmbuild gnu-tar to get the additional tools you need. That means you're going to need Homebrew. And if you're going to install Homebrew, or already have, you can simply do something like this to get your Go environment up and build the packages:

brew install rpmbuild gnu-tar go dep
sudo gem install --no-document fpm
mkdir ~/go/{src,mod}
export GOPATH=~/go
cd ~go/src
git clone https://github.com/unifi-poller/unifi-poller.git
cd unifi-poller
make rpm deb