Florian Zirker
30ebabc2ec
- Therefore split telegraf into two instances one for host and docker and other for network queries (network monitoring)
123 lines
3.5 KiB
YAML
123 lines
3.5 KiB
YAML
version: "3.3"
|
|
services:
|
|
|
|
grafana:
|
|
image: grafana/grafana:7.4.3
|
|
restart: unless-stopped
|
|
networks:
|
|
- web
|
|
- grafana
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.grafana.rule=Host(`monitoring.${DOMAIN}`)"
|
|
- "traefik.http.routers.grafana.entrypoints=websecure"
|
|
- "traefik.http.routers.grafana.tls.certresolver=netcup"
|
|
- "traefik.http.routers.grafana.tls.options=intermediate@file"
|
|
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
|
|
- "traefik.docker.network=web"
|
|
- "docker.group=monitoring"
|
|
environment:
|
|
- GF_DEFAULT_INSTANCE_NAME=monitoring.${DOMAIN}
|
|
- GF_SERVER_ROOT_URL=http://monitoring.${DOMAIN}
|
|
- GF_SERVER_DOMAIN=monitoring.${DOMAIN}
|
|
- GF_SERVER_SERVE_FROM_SUB_PATH=true
|
|
- GF_SECURITY_DISABLE_GRAVATAR=true
|
|
- GF_AUTH_ANONYMOUS_ENABLED=false
|
|
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
|
|
- GF_DATABASE_TYPE=postgres
|
|
- GF_DATABASE_HOST=grafanadb:5432
|
|
- GF_DATABASE_SSL_MODE=disable
|
|
- GF_DATABASE_NAME=grafana
|
|
- GF_DATABASE_USER=${POSTGRES_USER}
|
|
- GF_DATABASE_PASSWORD=${POSTGRES_PASSWORD}
|
|
- GF_INSTALL_PLUGINS=flant-statusmap-panel
|
|
depends_on:
|
|
- influxdb
|
|
- grafanadb
|
|
|
|
|
|
grafanadb:
|
|
image: postgres
|
|
volumes:
|
|
- ${VOLUMES_PATH}/grafanadb:/var/lib/postgresql/data
|
|
networks:
|
|
- grafana
|
|
restart: unless-stopped
|
|
environment:
|
|
- POSTGRES_DB=grafana
|
|
- POSTGRES_USER=${POSTGRES_USER}
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
|
labels:
|
|
- "docker.group=monitoring"
|
|
|
|
|
|
influxdb:
|
|
image: influxdb:1.8
|
|
restart: unless-stopped
|
|
networks:
|
|
- web
|
|
environment:
|
|
- INFLUXDB_MONITOR_STORE_ENABLED=false
|
|
volumes:
|
|
- ${VOLUMES_PATH}/influxdb/:/var/lib/influxdb
|
|
- ${PWD}/influxdb.conf:/etc/influxdb/influxdb.conf:ro
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.influxdb.rule=Host(`influxdb.${DOMAIN}`)"
|
|
- "traefik.http.routers.influxdb.entrypoints=websecure"
|
|
- "traefik.http.routers.influxdb.tls.certresolver=netcup"
|
|
- "traefik.http.routers.influxdb.tls.options=intermediate@file"
|
|
- "traefik.http.services.influxdb.loadbalancer.server.port=8086"
|
|
- "traefik.http.routers.influxdb.middlewares=influxauth"
|
|
- "traefik.http.middlewares.influxauth.basicauth.users=${INFLUXDB_HTPASSWD}"
|
|
- "docker.group=monitoring"
|
|
|
|
|
|
|
|
##################################################################
|
|
# here starts data collection
|
|
|
|
telegraf_host:
|
|
image: telegraf:1.18
|
|
restart: unless-stopped
|
|
environment:
|
|
- HOST_MOUNT_PREFIX=/hostfs
|
|
- HOST_PROC=/hostfs/proc
|
|
- HOST_SYS=/hostfs/sys
|
|
- HOST_ETC=/hostfs/etc
|
|
- HOST_VAR=/hostfs/var
|
|
- HOST_RUN=/hostfs/run
|
|
env_file:
|
|
- ./.env # set environments into container
|
|
volumes:
|
|
- ./telegraf_host.conf:/etc/telegraf/telegraf.conf:ro
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
- /var/run/utmp:/var/run/utmp:ro
|
|
- /:/hostfs:ro
|
|
network_mode: "host"
|
|
labels:
|
|
- "docker.group=monitoring"
|
|
depends_on:
|
|
- influxdb
|
|
|
|
telegraf_net:
|
|
image: telegraf:1.18
|
|
restart: unless-stopped
|
|
env_file:
|
|
- ./.env # set environments into container
|
|
volumes:
|
|
- ./telegraf_net.conf:/etc/telegraf/telegraf.conf:ro
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
networks:
|
|
- monitoring
|
|
labels:
|
|
- "docker.group=monitoring"
|
|
depends_on:
|
|
- influxdb
|
|
|
|
networks:
|
|
grafana:
|
|
monitoring:
|
|
external: true
|
|
web:
|
|
external: true
|