make grafana stack instantly deployable

This commit is contained in:
L4RM4ND 2023-02-24 22:09:30 +01:00
parent efda369edd
commit 445fd9d7cb
8 changed files with 37 additions and 22 deletions

View File

@ -0,0 +1 @@
/var/run/vmblock-fuse/blockdir/VBfYaD/Grafana_Dashboard_Template.json

View File

@ -2,3 +2,17 @@
- https://blog.lrvt.de/monitoring-dashboard-with-grafana-telegraf-influxdb-and-docker/ - https://blog.lrvt.de/monitoring-dashboard-with-grafana-telegraf-influxdb-and-docker/
- https://blog.lrvt.de/log-visualization-with-grafana-loki-promtail/ - https://blog.lrvt.de/log-visualization-with-grafana-loki-promtail/
# Notes
Spawning up this docker stack will provide you with:
- A containerized Grafana web instance runnning on the default port TCP/3000
- A containerized Telegraf instances that fetches data points from your docker host server
- A containerized InfluxDB instance for storing Telegraf data, which can be defined in Grafana as datasource (just specify `http://influxdb:8086`). Default database is `telegraf`. Default username is `telegrafuser`. Default password is `MyStrongTelegrafPassword`. Defaults can be changed in `/volume-data/influxdb/init/create-database.iql`.
- A containerized Promtail instance that can fetch various log and send them into Loki (e.g. /var/log/auth.log or your Traefik reverse proxy logs)
- A containerized Loki instance for storing Promtail data, which can be defined in Grafana as datasource (just specify `http://loki:3100`). No authentication enabled per default.
Finally, after configuring InfluxDB and Loki as datasources on Grafana, you can just import the provided `Grafana_Dashboard_Template.json` dashboard template YAML file in Grafana by browsing http://127.0.0.1:3000/dashboard/import. Your dashboard will look like the following:
<img src="https://blog.lrvt.de/content/images/2022/11/image-4-1.png">

View File

@ -7,14 +7,14 @@ services:
hostname: loki hostname: loki
container_name: loki container_name: loki
volumes: volumes:
- /mnt/docker-volumes/loki:/etc/loki # see example-configs and place loki-config.yml - ./volume-data/loki:/etc/loki # see example-configs and place loki-config.yml
ports: ports:
- "127.0.0.1:3100:3100" - "127.0.0.1:3100:3100"
restart: unless-stopped restart: unless-stopped
user: 1000:1000 user: 1000:1000
command: -config.file=/etc/loki/loki-config.yml command: -config.file=/etc/loki/loki-config.yml
networks: #networks:
- monitoring_default # - monitoring_default
promtail: promtail:
image: grafana/promtail:latest image: grafana/promtail:latest
@ -23,13 +23,13 @@ services:
- loki - loki
hostname: promtail hostname: promtail
volumes: volumes:
- /var/log:/var/log - /var/log:/var/log:ro # let promtail access the docker host's log files
- /mnt/docker-volumes/promtail:/etc/promtail # see example-configs and place promtail-config.yml - ./volume-data/promtail:/etc/promtail # see example-configs and place promtail-config.yml
#- /mnt/docker-volumes/traefik/logs:/var/log/traefik #- /mnt/docker-volumes/traefik/logs:/var/log/traefik # let promtail access your traefik reverse logs
restart: unless-stopped restart: unless-stopped
command: -config.file=/etc/promtail/promtail-config.yml command: -config.file=/etc/promtail/promtail-config.yml
networks: #networks:
- monitoring_default # - monitoring_default
influxdb: influxdb:
image: influxdb:1.8.10 image: influxdb:1.8.10
@ -37,14 +37,14 @@ services:
hostname: influxdb hostname: influxdb
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- /mnt/docker-volumes/influxdb/data:/var/lib/influxdb - ./volume-data/influxdb/data:/var/lib/influxdb
- /mnt/docker-volumes/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro # see example-configs and place infuxdb.conf - ./volume-data/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro # see example-configs and place infuxdb.conf
- /mnt/docker-volumes/influxdb/init:/docker-entrypoint-initdb.d # see example-configs and place create-database.iql - ./volume-data/influxdb/init:/docker-entrypoint-initdb.d # see example-configs and place create-database.iql
environment: environment:
- INFLUXDB_ADMIN_USER=admin - INFLUXDB_ADMIN_USER=admin
- INFLUXDB_ADMIN_PASSWORD=SuperDuperAdminPW - INFLUXDB_ADMIN_PASSWORD=SuperDuperAdminPW
networks: #networks:
- monitoring_default # - monitoring_default
telegraf: telegraf:
image: telegraf:latest image: telegraf:latest
@ -58,7 +58,7 @@ services:
depends_on: depends_on:
- influxdb - influxdb
volumes: volumes:
- /mnt/docker-volumes/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro # see example-configs and place telegraf.conf - ./volume-data/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro # see example-configs and place telegraf.conf
- /:/hostfs:ro - /:/hostfs:ro
- /etc:/hostfs/etc:ro - /etc:/hostfs/etc:ro
- /proc:/hostfs/proc:ro - /proc:/hostfs/proc:ro
@ -70,8 +70,8 @@ services:
- HOST_PROC=/hostfs/proc - HOST_PROC=/hostfs/proc
- HOST_SYS=/hostfs/sys - HOST_SYS=/hostfs/sys
- HOST_MOUNT_PREFIX=/hostfs - HOST_MOUNT_PREFIX=/hostfs
networks: #networks:
- monitoring_default # - monitoring_default
grafana: grafana:
container_name: grafana container_name: grafana
@ -86,11 +86,11 @@ services:
#environment: #environment:
# - GF_SERVER_ROOT_URL=https://grafana.example.com # optional # - GF_SERVER_ROOT_URL=https://grafana.example.com # optional
volumes: volumes:
- /mnt/docker-volumes/grafana:/var/lib/grafana - ./volume-data/grafana:/var/lib/grafana
ports: ports:
- 3000:3000 - 3000:3000
networks: #networks:
- monitoring_default # - monitoring_default
#labels: #labels:
# - traefik.enable=true # - traefik.enable=true
# - traefik.http.routers.grafana.rule=Host(`grafana.example.com`) # - traefik.http.routers.grafana.rule=Host(`grafana.example.com`)
@ -99,6 +99,6 @@ services:
# # Part for local lan services only # # Part for local lan services only
# - traefik.http.routers.grafana.middlewares=local-ipwhitelist@file # - traefik.http.routers.grafana.middlewares=local-ipwhitelist@file
networks: #networks:
monitoring_default: # monitoring_default:
external: true # external: true