forked from admin/Server
unifi naar grafana
This commit is contained in:
155
unifi-to-grafana-dockerr
Normal file
155
unifi-to-grafana-dockerr
Normal file
@@ -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://<server-ip>:3000
|
||||
Prometheus: http://<server-ip>:9090
|
||||
Unpoller: http://<server-ip>:9130/metrics
|
||||
Reference in New Issue
Block a user