unpoller / unpoller

Application: Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus
https://unpoller.com
MIT License
2.06k stars 146 forks source link

Empty dashboard #531

Closed adrianmihalko closed 1 year ago

adrianmihalko commented 1 year ago

Hi,

Installed and configured unpoller, I see data in prometheus, but in grafana I can't see any data.

Docker log:

unpoller         | 2023/03/10 13:57:36 [INFO] UniFi Measurements Exported. Site: 2, Client: 54, UAP: 5, USG/UDM: 1, USW: 2, DPI Site/Client: 2/0, Desc: 196, Metric: 2124, Err: 3, 0s: 571, Req/Total: 37.8ms / 55.3ms
unpoller         | 2023/03/10 13:58:06 [INFO] UniFi Measurements Exported. Site: 2, Client: 54, UAP: 5, USG/UDM: 1, USW: 2, DPI Site/Client: 2/0, Desc: 196, Metric: 2124, Err: 3, 0s: 567, Req/Total: 40.3ms / 56.5ms
unpoller         | 2023/03/10 13:58:36 [INFO] UniFi Measurements Exported. Site: 2, Client: 54, UAP: 5, USG/UDM: 1, USW: 2, DPI Site/Client: 2/0, Desc: 196, Metric: 2124, Err: 3, 0s: 562, Req/Total: 39ms / 57ms
unpoller         | 2023/03/10 13:59:06 [INFO] UniFi Measurements Exported. Site: 2, Client: 54, UAP: 5, USG/UDM: 1, USW: 2, DPI Site/Client: 2/0, Desc: 196, Metric: 2124, Err: 3, 0s: 555, Req/Total: 47.1ms / 71.4ms

Prometheus:

Screenshot 2023-03-10 at 14 42 50

Grafana:

I selected my prometheus server while adding the dashboard, but I can't get any data. Grafana-Prometheus itself works, because from Node-Explorer on another dashboard I see data:

Screenshot 2023-03-10 at 14 41 42

Configs:

prometheus:

$ cat config/prometheus.yml 
# my global config
global:
  scrape_interval:     60s # Set the scrape interval to every 15 seconds. Default is every 1 minute.

  # scrape_timeout is set to the global default (10s).
  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
      monitor: 'codelab-monitor'
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['prometheus:9090']
  - job_name: 'node_exporter'
    static_configs:
      - targets: ['node_exporter:9100']
  - job_name: 'ubuntu_1.54'
    static_configs:
      - targets: ['192.168.1.54:9100']
  - job_name: 'unifipoller'
    scrape_interval: 30s
    static_configs:
    - targets: ['unpoller:9130']

docker-compose:

version: '3.3'
volumes:
  prometheus-data:
    driver: local
  grafana-data:
    driver: local
services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    volumes:
      - ./config:/etc/prometheus/
      - prometheus-data:/prometheus
    networks:
      - prometheus-network
    ports:
      - "9090:9090"
  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: unless-stopped
    volumes:
      - grafana-data:/var/lib/grafana
    networks:
      - prometheus-network
    ports:
      - "3000:3000"
  unpoller:
    image: ghcr.io/unpoller/unpoller:latest
    restart: unless-stopped
    ports:
      - '9130:9130'
    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: unifipoller
      UP_UNIFI_CONTROLLER_0_PASS: easytoguess
      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://192.168.1.54:9443
      UP_UNIFI_CONTROLLER_0_USER:xy@gmail.com
    networks:
      - prometheus-network    
  node_exporter:
    image: quay.io/prometheus/node-exporter:latest
    container_name: node_exporter
    command:
      - '--path.rootfs=/host'
    pid: host
    ports:
      - "9100:9100"
    restart: unless-stopped
    volumes:
      - '/:/host:ro,rslave'
    networks:
      - prometheus-network
networks:
  prometheus-network:
    driver: bridge
discostu105 commented 1 year ago

Had the same problem. The reason is, the Grafana dashboards are assuming "unpoller" as prefix, whereas unifipoller seems to have changed the default prefix to "unifipoller".

Solution that worked for me: change the prefix per env var:

UP_PROMETHEUS_NAMESPACE: unpoller

With that, Grafana dashboards work.

koalaeagle commented 1 year ago

Also ran into this. Cheers for the fix!