Monitoring Stack
A comprehensive monitoring stack providing infrastructure and container observability out of the box. Prometheus scrapes metrics from Node Exporter (host-level CPU, memory, disk, and network stats) and cAdvisor (per-container resource usage), retaining data for 15 days. Grafana ships with pre-configured datasource provisioning pointed at Prometheus, ready for dashboard imports. All services communicate over a dedicated monitoring network with health checks ensuring readiness before dependent services start. Resource limits prevent the monitoring stack itself from starving application workloads.
Services Inclus
prometheus
prom/prometheus:v2.53.3
grafana
grafana/grafana:11.4.0
Variables d'Environnement :
node_exporter
prom/node-exporter:v1.8.2
cadvisor
gcr.io/cadvisor/cadvisor:v0.49.1
YAML Généré
# Generated by ComposeHub (composehub.dev)
name: monitoring-stack
services:
prometheus:
image: prom/prometheus:v2.53.3
restart: unless-stopped
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=15d"
- "--storage.tsdb.retention.size=10GB"
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
- "--web.console.templates=/usr/share/prometheus/consoles"
- "--web.enable-lifecycle"
ports:
- 9090:9090
volumes:
- prometheus_data:/prometheus
- prometheus_config:/etc/prometheus
networks:
- monitoring
depends_on:
node_exporter:
condition: service_healthy
cadvisor:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- wget --no-verbose --tries=1 --spider http://localhost:9090/-/healthy || exit 1
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
deploy:
resources:
limits:
cpus: "1.00"
memory: 1024M
reservations:
cpus: "0.25"
memory: 256M
labels:
com.composeforge.description: Prometheus time-series database and metrics collector
grafana:
image: grafana/grafana:11.4.0
restart: unless-stopped
ports:
- 3000:3000
volumes:
- grafana_data:/var/lib/grafana
- grafana_provisioning:/etc/grafana/provisioning
environment:
GF_SECURITY_ADMIN_USER: ${GF_SECURITY_ADMIN_USER:-admin}
GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD:-admin}
GF_USERS_ALLOW_SIGN_UP: ${GF_USERS_ALLOW_SIGN_UP:-false}
GF_SERVER_ROOT_URL: ${GF_SERVER_ROOT_URL:-http://localhost:3000}
GF_INSTALL_PLUGINS: ${GF_INSTALL_PLUGINS:-}
networks:
- monitoring
depends_on:
prometheus:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- curl -f http://localhost:3000/api/health || exit 1
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
labels:
com.composeforge.description: Grafana dashboarding and visualization platform
node_exporter:
image: prom/node-exporter:v1.8.2
restart: unless-stopped
command:
- "--path.procfs=/host/proc"
- "--path.sysfs=/host/sys"
- "--path.rootfs=/rootfs"
- "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)"
expose:
- "9100"
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
networks:
- monitoring
healthcheck:
test:
- CMD-SHELL
- wget --no-verbose --tries=1 --spider http://localhost:9100/metrics || exit 1
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
deploy:
resources:
limits:
cpus: "0.25"
memory: 128M
reservations:
cpus: "0.05"
memory: 32M
labels:
com.composeforge.description: Prometheus Node Exporter for host-level metrics
read_only: true
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.49.1
restart: unless-stopped
expose:
- "8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
networks:
- monitoring
healthcheck:
test:
- CMD-SHELL
- wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
deploy:
resources:
limits:
cpus: "0.50"
memory: 256M
reservations:
cpus: "0.10"
memory: 64M
labels:
com.composeforge.description: cAdvisor container metrics exporter
privileged: true
networks:
monitoring:
driver: bridge
volumes:
prometheus_data:
driver: local
prometheus_config:
driver: local
grafana_data:
driver: local
grafana_provisioning:
driver: local
Informations Rapides
- Services
- 4
- Réseaux
- 1
- Volumes
- 4
Quand l'Utiliser
Ce modèle est idéal pour mettre en place un environnement monitoring stack Tous les services sont préconfigurés avec des healthchecks, des limites de ressources et des valeurs par défaut raisonnables. Personnalisez les variables d'environnement avant de déployer en production.
Conseils
- Changez tous les mots de passe par défaut avant le déploiement
- Vérifiez les limites de ressources pour votre matériel
- Ajoutez un reverse proxy pour le HTTPS en production
- Configurez des stratégies de sauvegarde pour les volumes de données