metrics_template/podman-compose.yml
2026-03-06 18:41:07 -05:00

162 lines
5.1 KiB
YAML

networks:
monitoring:
driver: bridge
volumes:
vm_data:
driver: local
driver_opts:
type: none
o: bind
device: ./victoriametrics/data
grafana_data:
driver: local
driver_opts:
type: none
o: bind
device: ./grafana/data
vmagent_data:
driver: local
driver_opts:
type: none
o: bind
device: ./vmagent/data
kuma_data:
driver: local
driver_opts:
type: none
o: bind
device: ./uptime_kuma/data
services:
# --------------------------------------------------------------------------
# VictoriaMetrics — time-series database
# --------------------------------------------------------------------------
victoriametrics:
image: victoriametrics/victoria-metrics:latest
container_name: victoriametrics
restart: unless-stopped
ports:
- "${BIND_HOST}:${VM_PORT}:8428"
volumes:
- vm_data:/storage
command:
- "--storageDataPath=/storage"
- "--retentionPeriod=${VM_RETENTION_PERIOD}"
- "--dedup.minScrapeInterval=60s"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8428/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- monitoring
# --------------------------------------------------------------------------
# vmagent — Prometheus-compatible scrape agent
# See vmagent/config/scrape.yml to add endpoints
# --------------------------------------------------------------------------
vmagent:
image: victoriametrics/vmagent:latest
container_name: vmagent
restart: unless-stopped
ports:
- "${BIND_HOST}:${VMAGENT_PORT}:8429"
volumes:
- ./vmagent/config/scrape.yml:/etc/vmagent/scrape.yml:ro
- vmagent_data:/vmagent_data
command:
- "--promscrape.config=/etc/vmagent/scrape.yml"
- "--remoteWrite.url=http://victoriametrics:8428/api/v1/write"
- "--promscrape.config.strictParse=false"
- "--remoteWrite.tmpDataPath=/vmagent_data"
depends_on:
victoriametrics:
condition: service_healthy
networks:
- monitoring
# --------------------------------------------------------------------------
# Grafana — dashboards and visualization
# --------------------------------------------------------------------------
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
ports:
- "${BIND_HOST}:${GF_PORT}:3000"
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning:ro
environment:
- GF_SECURITY_ADMIN_USER=${GF_ADMIN_USER}
- GF_SECURITY_ADMIN_PASSWORD=${GF_ADMIN_PASSWORD}
- GF_ANALYTICS_REPORTING_ENABLED=false
- GF_ANALYTICS_CHECK_FOR_UPDATES=false
- GF_USERS_ALLOW_SIGN_UP=false
- TZ=${TZ}
networks:
- monitoring
# --------------------------------------------------------------------------
# Uptime Kuma — availability monitoring with alerting
# --------------------------------------------------------------------------
uptime-kuma:
image: louislam/uptime-kuma:2
container_name: uptime-kuma
restart: unless-stopped
ports:
- "${BIND_HOST}:${KUMA_PORT}:3001"
volumes:
- kuma_data:/app/data
environment:
- UPTIME_KUMA_WS_ORIGIN_CHECK=${UPTIME_KUMA_WS_ORIGIN_CHECK}
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001"]
interval: 30s
timeout: 10s
retries: 3
networks:
- monitoring
# --------------------------------------------------------------------------
# node_exporter — Linux host metrics (the machine running this stack)
# Provides CPU, memory, disk, network, and filesystem metrics for this host.
# --------------------------------------------------------------------------
node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- "--path.procfs=/host/proc"
- "--path.rootfs=/rootfs"
- "--path.sysfs=/host/sys"
- "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)"
networks:
- monitoring
# --------------------------------------------------------------------------
# snmp_exporter — SNMP metrics for network devices (switches, routers, APs)
# OPTIONAL: Uncomment this service if you need SNMP monitoring.
# You must also provide a valid snmp_exporter/snmp.yml config.
# Download a pre-built snmp.yml: https://github.com/prometheus/snmp_exporter/releases
# --------------------------------------------------------------------------
# snmp-exporter:
# image: prom/snmp-exporter:latest
# container_name: snmp-exporter
# restart: unless-stopped
# ports:
# - "${BIND_HOST}:9116:9116"
# volumes:
# - ./snmp_exporter/snmp.yml:/etc/snmp_exporter/snmp.yml:ro
# command:
# - "--config.file=/etc/snmp_exporter/snmp.yml"
# networks:
# - monitoring