This page explains how to configure Prometheus and UnPoller. For help installing Prometheus you'll have to look elsewhere; that's not in this document. If you need help getting started, InfluxDB is recommended.
Prometheus support was added in the 1.6 release, but was not very well documented. Release 2.0 brings with it a re-write of the prometheus integration. Many changes were made to how one may configure a controller. This page only applies to version 2.0.1+.
Then you simply point prometheus at unpoller using a config like this:
If you have other scrape configs, leave them there. Just add a new one for
Replace localhost with the IP of the host running Poller.
That's it! Restart Prometheus and it should begin to scrape data from your controller through Poller.
UnPoller needs to be accessible on TCP port 9130. This may require exposing ports or modifying firewalls.
You can either configure the controllers in unpoller or poll them unconfigured. When polling unconfigured, you must enable dynamic. You can scrape multiple controllers in several ways. Here is a list of options:
- Set all controller user/passwords the same and pass in controller URLs from Prometheus. To do this, you set the username and password as the default in the unifi config.
- Configure each controller in unpoller and pass in urls from Prometheus. This allows them to have different usernames and passwords.
- NOT Recommended: Configure each controller in unpoller and configure prometheus as shown above in the Single Controller section. This is useful when you want to poll all the controllers at the same time from a single prometheus instance.
This describes approach 1 above.
Using this approach all you need to configure for controllers in unpoller is the name and password. Example below. Any settings you provide to [unifi.defaults] will be used for all controllers passed in from Prometheus. All other settings are optional.
Or with env variables:
This describes approach 2 above.
Configure each controller in up.conf or using environment variables. When Prometheus scrapes from unpoller the poller will map the URL directly to the one configured in up.conf (or using env vars). Just make sure the url you put into the prometheus configuration matches the url put into the poller configuration.
Example polling two controllers:
Or with env variables:
This applies to both approaches above. Configure prometheus like this:
localhost with the IP of your unpoller host, and replace
and another.controller with the IPs of your controllers.
Just configure your controllers in
up.conf or using env variables as explained in the
Application Configuration page. Then setup Prometheus like this:
/metrics path that the above snippet uses returns metrics for all configured controllers.