unpoller / unpoller

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

Portainer Config #734

Open mlinko6 opened 2 months ago

mlinko6 commented 2 months ago

Dear All,

can someone help me out with the portainer stack config? That would be awesome:

version: "3.9"
services:
  influxdb:
    container_name: unifi_poller_influxdb
    image: influxdb:1.8
    ports:
      - 8086:8086
    volumes:
      - /volume1/docker/unifi_poller_influxdb:/var/lib/influxdb
    environment:
      - INFLUXDB_DATA_DIR=/var/lib/influxdb/data
      - INFLUXDB_DATA_WAL_DIR=/var/lib/influxdb/wal
      - INFLUXDB_DATA_META_DIR=/var/lib/influxdb/meta
    networks:
      manual: 
        ipv4_address: 172.18.0.31
    restart: on-failure:5   

unifi-poller:
    image: ghcr.io/unpoller/unpoller:latest
    container_name: unifi_poller
    hostname: unifi_poller
    volumes:
      - /volume1/docker/unifi_poller:/config
    ports:
      - 9130:9130
    environment:
      - UP_INFLUXDB_URL=http://172.18.0.31:8086
      - UP_UNIFI_CONTROLLER_0_USER=unifi_poller
      - UP_UNIFI_CONTROLLER_0_PASS=(unifi_poller_password)
      - 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.1:8443
      -UP_POLLER_DEBUG="true"

    networks:
      manual: 
        ipv4_address: 172.18.0.32
    restart: on-failure:5

networks:
  manual:
    external: true

I think that I didn't configure the InfluxDB Part correctly, thank you for your help!

KR Rok

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

mlinko6 commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Apparently no one uses the Portainer to configure the containers

davidnewhall commented 1 month ago

Not many do, and you didn't describe a problem you needed help with, so those that don't use portioner aren't sure how to direct you. At first glance, the indentation in your YAML looks very wrong.

sandman98321 commented 1 month ago

Edit: Braindead enough as I wrote this that I completely missed OP wanting help with Influx not Prometheus, which this doesn't really help with.....devs please let me know if you want me to create a separate issue, leave this for posterity, or whatever. Edit by dev: it may stay, thanks!

Just thought I'd post a working Prometheus/Portainer config for you (or maybe for the devs to offer some insight into, or help improve docs, or whatever).

I have just gotten Prometheus going in the last week or so, so I am not going to have much insight beyond what I'm posting here. (Yes, I need to fix permissions and stop running Prometheus as root, as well as a couple other things....but this at least gets a basic "up and running" config).

I'm not sure if it's a weirdness in Portainer, or the documentation is slightly unclear and I was mis-reading it. I kept getting errors about being unable to bind the port in the unpoller log, which would then cause it to throw other errors about accessing the Unifi Controller. What got it working was having a discreet port assignment in the Unpoller stack, while also deleting the http_listen line in up.conf.

Portainer Stack Excerpt:

prometheus:
  image: prom/prometheus
  user: '0'
  container_name: prometheus
  ports:
    - 9090:9090
  restart: unless-stopped
  volumes:
    - /home/[redacted]/docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
    - /home/[redacted]/docker/prometheus/prom_data:/prometheus
  command:
    - '--config.file=/etc/prometheus/prometheus.yml'
unpoller:
  image: ghcr.io/unpoller/unpoller:latest
  restart: unless-stopped
  ports:
    - 9130:9130
  container_name: unpoller
  volumes:
    - /home/[username]/docker/unpoller:/etc/unpoller

up.conf:

[poller]
  debug = false
  quiet = false
  plugins = []
[prometheus]
  disable = false
  report_errors = false
  dead_ports = false
[influxdb]
  disable = true
[loki]
  disable = true
[datadog]
  enable = false
[webserver]
  enable = false
[webserver.accounts]
[unifi]
  dynamic = false
[unifi.defaults]
  url = "https://192.168.1.1"
  user = "Prometheus"
  pass = "[redacted]"
  sites = ["all"]
  save_sites = false
  hash_pii = false
  save_ids = false
  save_events = false
  save_alarms = false
  save_anomalies = false
  save_rogue = false
  verify_ssl = false
  ssl_cert_paths = []

Prometheus.yml: (xxx.xxx.xxx.121 is the Portainer server IP)

- job_name: 'unpoller'
  scrape_interval: 30s
  metrics_path: /metrics
  static_configs:
  - targets: ['192.168.1.121:9130']
github-actions[bot] commented 1 day ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.