Unpoller Prometheus UCG Ultra

I run my prometheus and grafana stack separate but on the same docker network 1.

services:
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    restart: unless-stopped
    volumes:
      - 'prometheus:/etc/prometheus'
      - 'prom_data:/prometheus'
    networks:
      - traefik-proxy
  grafana:
    image: grafana/grafana
    container_name: grafana
    restart: unless-stopped
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=<your-password>
      - GF_INSTALL_PLUGINS=grafana-clock-panel,natel-discrete-panel,grafana-piechart-panel
    volumes:
       - 'grafana:/var/lib/grafana'
    networks:
      - traefik-proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.grafana.rule=Host(`your-domain.com`)"
      - "traefik.http.routers.grafana.entrypoints=websecure"
      - "traefik.http.routers.grafana.tls=true"
      - "traefik.http.services.grafana.loadbalancer.server.port=3000"
      - "traefik.http.routers.grafana.tls.certresolver=letsencrypt"
      - "traefik.http.routers.grafana.tls.domains[0].main=your-domain.com"
      - "traefik.http.routers.grafana.tls.domains[0].sans=*.your-domain.com"
volumes:
  prom_data:
  prometheus:
  grafana:
networks:
  traefik-proxy:
    external: true
  1. Add the Prometheus data source from within Grafana

  2. Log in to Unifi and create the "service account"

  3. I set mine up like this

  1. Create the Unpoller stack By default, some guides says that "UP_UNIFI_CONTROLLER_0_URL" is supposed to be address:port, but that never worked for my UCG Ultra, removing the port did the trick for me.

name: unpoller
services:
  unpoller:
    image: ghcr.io/unpoller/unpoller:latest
    restart: unless-stopped
    container_name: unpoller
    environment:
      - UP_INFLUXDB_DISABLE=true
      - UP_POLLER_DEBUG=false
      - UP_UNIFI_DYNAMIC=false
      - UP_PROMETHEUS_HTTP_LISTEN=0.0.0.0:9130
      - UP_PROMETHEUS_NAMESPACE=unpoller
      - UP_UNIFI_CONTROLLER_0_PASS=<password-to-unpoller-account>
      - UP_UNIFI_CONTROLLER_0_SAVE_ALARMS=true
      - UP_UNIFI_CONTROLLER_0_SAVE_ANOMALIES=true
      - UP_UNIFI_CONTROLLER_0_SAVE_DPI=true
      - UP_UNIFI_CONTROLLER_0_SAVE_EVENTS=true
      - UP_UNIFI_CONTROLLER_0_SAVE_IDS=true
      - UP_UNIFI_CONTROLLER_0_SAVE_SITES=true
      - UP_UNIFI_CONTROLLER_0_URL=https://ipaddress-to-controller
      - UP_UNIFI_CONTROLLER_0_USER=unpoller
    networks:
      - traefik-proxy
networks:
  traefik-proxy:
    external: true
  1. Create the scrape config in Prometheus

  2. docker exec -it unpoller /bin/sh

  3. vi /etc/prometheus/prometheus.yml

  4. Add the scrape config

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]
  - job_name: 'unifipoller'
    scrape_interval: 30s
    static_configs:
      - targets: ['unpoller:9130']

Last updated