prometheus + grafana 搭建
docker-compose.yml
version: \'3.8\'services: prometheus: image: prom/prometheus:latest container_name: prometheus ports: - \"9090:9090\" volumes: - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml grafana: image: grafana/grafana:latest container_name: grafana ports: - \"3000:3000\" environment: - GF_SECURITY_ADMIN_USER=admin - GF_SECURITY_ADMIN_PASSWORD=admin volumes: - grafana_data:/var/lib/grafana node_exporter: image: prom/node-exporter:latest container_name: node_exporter ports: - \"9100:9100\" volumes: grafana_data:
prometheus/prometheus.yml
global: scrape_interval: 15sscrape_configs: - job_name: \'prometheus\' static_configs: - targets: [\'prometheus:9090\'] - job_name: \'node_exporter\' static_configs: - targets: [\'node_exporter:9100\']
启动
docker compose up -d
http://localhost:3000/
http://localhost:9100/
停止
docker compose down