mirror of
https://github.com/Dannecron/grafana-for-dev.git
synced 2025-12-25 15:52:35 +03:00
[feature] add prometheus and node_exporter services, remove default values from docker-compose.yml
add simple config for prometheus
This commit is contained in:
11
.env.example
11
.env.example
@@ -1,4 +1,13 @@
|
||||
COMPOSE_PROFILES=grafana,promtail
|
||||
COMPOSE_PROFILES=grafana
|
||||
|
||||
GRAFANA_VERSION=9.1.7
|
||||
GRAFANA_HOST=grafana.docker.localhost
|
||||
|
||||
LOKI_STACK_VERSION=2.6.0
|
||||
LOKI_HOST=loki.docker.localhost
|
||||
LOKI_PROMTAIL_HOST=promtail.docker.localhost
|
||||
|
||||
PROMETHEUS_VERSION=v2.43.0
|
||||
PROMETHEUS_NODE_EXPORTER_VERSION=v1.5.0
|
||||
PROMETHEUS_HOST=prometheus.docker.localhost
|
||||
PROMETHEUS_RETENTION_TIME=10d
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
/.idea/
|
||||
/.vscode/
|
||||
|
||||
/.env
|
||||
/docker-compose.override.yml
|
||||
@@ -6,7 +6,7 @@ services:
|
||||
image: grafana/grafana:${GRAFANA_VERSION:-latest}
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.grafana.rule=Host(`grafana.docker.localhost`)"
|
||||
- "traefik.http.routers.grafana.rule=Host(`${GRAFANA_HOST}`)"
|
||||
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
|
||||
expose:
|
||||
- 3000
|
||||
@@ -17,10 +17,10 @@ services:
|
||||
- grafana
|
||||
|
||||
loki:
|
||||
image: grafana/loki:${LOKI_STACK_VERSION:-2.6.0}
|
||||
image: grafana/loki:${LOKI_STACK_VERSION}
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.loki.rule=Host(`loki.docker.localhost`)"
|
||||
- "traefik.http.routers.loki.rule=Host(`${LOKI_HOST}`)"
|
||||
- "traefik.http.services.loki.loadbalancer.server.port=3100"
|
||||
expose:
|
||||
- 3100
|
||||
@@ -31,10 +31,10 @@ services:
|
||||
- grafana
|
||||
|
||||
promtail:
|
||||
image: grafana/promtail:${LOKI_STACK_VERSION:-2.6.0}
|
||||
image: grafana/promtail:${LOKI_STACK_VERSION}
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.grafana.rule=Host(`promtail.docker.localhost`)"
|
||||
- "traefik.http.routers.grafana.rule=Host(`${LOKI_PROMTAIL_HOST}`)"
|
||||
- "traefik.http.services.grafana.loadbalancer.server.port=9080"
|
||||
expose:
|
||||
- 9080
|
||||
@@ -46,5 +46,43 @@ services:
|
||||
profiles:
|
||||
- promtail
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:${PROMETHEUS_VERSION}
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.prometheus.rule=Host(`${PROMETHEUS_HOST}`)"
|
||||
- "traefik.http.services.prometheus.loadbalancer.server.port=9090"
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
- '--storage.tsdb.retention.time=${PROMETHEUS_RETENTION_TIME:-10d}'
|
||||
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
|
||||
- '--web.console.templates=/usr/share/prometheus/consoles'
|
||||
expose:
|
||||
- 9090
|
||||
volumes:
|
||||
- ./prometheus/:/etc/prometheus/
|
||||
- prometheus-data:/prometheus
|
||||
profiles:
|
||||
- prometheus
|
||||
|
||||
node-exporter:
|
||||
image: prom/node-exporter:${PROMETHEUS_NODE_EXPORTER_VERSION}
|
||||
restart: on-failure
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /:/rootfs:ro
|
||||
command:
|
||||
- '--path.procfs=/host/proc'
|
||||
- '--path.sysfs=/host/sys'
|
||||
- --collector.filesystem.ignored-mount-points
|
||||
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
|
||||
expose:
|
||||
- 9100
|
||||
profiles:
|
||||
- prometheus
|
||||
|
||||
volumes:
|
||||
grafana-storage:
|
||||
prometheus-data:
|
||||
|
||||
19
prometheus/prometheus.yml
Normal file
19
prometheus/prometheus.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
external_labels:
|
||||
monitor: 'dev-prometheus'
|
||||
|
||||
scrape_config_files:
|
||||
- /etc/prometheus/scrapes/*.yml
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'prometheus'
|
||||
scrape_interval: 15s
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
- job_name: 'node-exporter'
|
||||
scrape_interval: 15s
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
2
prometheus/scrapes/.gitignore
vendored
Normal file
2
prometheus/scrapes/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/*
|
||||
!/.gitignore
|
||||
Reference in New Issue
Block a user