Have you ever wanted to aggregate your Unifi networking data right alongside all the myriad other data points you've meticulously configured your system to collect?
Sure, you've already got more hand-tweaked Grafana graphs than could possibly fit on any screen in that tiny studio of yours, but still something was missing. It was those pretty network graphs.
This builds on the excellent Unifi Exporter package developed by @mdlayher, which unfortunately is no longer actively maintained, and provides an up-to-date, multi-arch image with the additional configuration manifests required for easy Kubernetes + Prometheus Operator integration.
In addition to the self-evident benefits of the tool itself, this integration offers:
A significantly slimmed down Docker image -- just 7MB compressed, compared to 150+MB.
Native multi-arch (i.e., as defined in the V2 image manifest, schema
2) support for
aarch64 architectures. Use it on your GCP VM's, your Raspberry Pis,
your Odroid C2's, Rock64's... you get the idea.
Turnkey integration with an existing Prometheus Operator deployment.
Ubiquiti gear, obviously; as well as a persistent connection to an instance of your Unifi controller — spinning it up as-needed on your local machine isn't going to cut it here. You can either spring for Ubiquiti's Cloud Key, or you can easily host it on your choice of hosting provider — AWS, GCP, Digital Ocean, Linode, Vultr, Scaleway, etc. all have VPS' that will meet the minimum requirements for <= $5 USD / month.
A Kubernetes cluster, with CoreOS' Prometheus Operator deployed. If not, check out the official-docs to get started; Carlos Eduardo also has a great writeup on his experience porting many of the Operator images to ARM architecture(s) that's well worth the read.
If you just want a multi-arch Docker image for the exporter, you can pull from
jessestuart/unifi_exporter:v0.4.0 and go to town — just bind mount your config
file into your container and follow the instructions in the exporter
monitoringnamespace, along with the rest of my exporters. (Although this isn't a strict requirement, using fields like the
serviceMonitorNamespaceSelectoroption on your
config.example.yml, and fill it in with your Unifi controller's credentials. This just require updating the host, username, and password; you may also need to change the port if your controller is behind a reverse proxy.
make generate-secretto create a Kubernetes secret storing the data in this file.
make deployto deploy to your cluster, and
make destroyto remove only those resources that were created.