From a9813324bda41b89d92e0e0133ed212ce88f7e14 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 5 Jan 2026 20:26:31 +0100 Subject: [PATCH] unifi naar grafana --- unifi-to-grafana-dockerr | 155 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 unifi-to-grafana-dockerr diff --git a/unifi-to-grafana-dockerr b/unifi-to-grafana-dockerr new file mode 100644 index 0000000..6108dfa --- /dev/null +++ b/unifi-to-grafana-dockerr @@ -0,0 +1,155 @@ +############################################################ +# docker-compose.yml +# UniFi → Unpoller → Prometheus → Grafana +############################################################ + +version: "3.8" + +services: + + unpoller: + image: ghcr.io/unpoller/unpoller:latest + container_name: unpoller + restart: unless-stopped + + environment: + # UniFi Controller + UP_UNIFI_DEFAULT_URL: "https://10.10.40.1" + UP_UNIFI_DEFAULT_USER: "service" + UP_UNIFI_DEFAULT_PASS: "Grafana2025!" + UP_UNIFI_DEFAULT_VERIFY_SSL: "false" + UP_UNIFI_DEFAULT_SITES: "all" + + # Prometheus exporter + UP_PROMETHEUS_HTTP_LISTEN: "0.0.0.0:9130" + + # Privacy (optioneel) + # UP_UNIFI_DEFAULT_HASH_PII: "true" + # UP_UNIFI_DEFAULT_DROP_PII: "true" + + ports: + - "9130:9130" + + networks: + - monitoring + + + prometheus: + image: prom/prometheus:latest + container_name: prometheus + restart: unless-stopped + + command: + - "--config.file=/etc/prometheus/prometheus.yml" + - "--storage.tsdb.path=/prometheus" + - "--web.enable-lifecycle" + + volumes: + - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro + - prometheus_data:/prometheus + + ports: + - "9090:9090" + + networks: + - monitoring + + + grafana: + image: grafana/grafana:latest + container_name: grafana + restart: unless-stopped + + environment: + GF_SECURITY_ADMIN_USER: "admin" + GF_SECURITY_ADMIN_PASSWORD: "admin" + GF_USERS_ALLOW_SIGN_UP: "false" + + volumes: + - grafana_data:/var/lib/grafana + - ./grafana/provisioning:/etc/grafana/provisioning + + ports: + - "3000:3000" + + networks: + - monitoring + + +networks: + monitoring: + + +volumes: + prometheus_data: + grafana_data: + + + +############################################################ +# prometheus/prometheus.yml +############################################################ + +global: + scrape_interval: 15s + +scrape_configs: + + - job_name: "prometheus" + static_configs: + - targets: + - "prometheus:9090" + + - job_name: "unpoller" + static_configs: + - targets: + - "unpoller:9130" + + + +############################################################ +# grafana/provisioning/datasources/datasource.yml +############################################################ + +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + url: http://prometheus:9090 + isDefault: true + + + +############################################################ +# Mappenstructuur +############################################################ + +monitoring/ +├── docker-compose.yml +├── prometheus/ +│ └── prometheus.yml +└── grafana/ + └── provisioning/ + └── datasources/ + └── datasource.yml + + + +############################################################ +# Starten +############################################################ + +cd monitoring +docker compose up -d + + + +############################################################ +# URLs +############################################################ + +Grafana: http://:3000 +Prometheus: http://:9090 +Unpoller: http://:9130/metrics