docker-compose部署prometheus监控
docker-prometheus.yml
version: '3' services: #添加普罗米修斯服务 prometheus: image: prom/prometheus:latest container_name: Myprometheus hostname: prometheus ports: - '9090:9090' volumes: - '/data/conf/prometheus.yml:/etc/prometheus/prometheus.yml' - '/data/prometheus/:/prometheus' # 指定容器中的配置文件 command: - '--config.file=/etc/prometheus/prometheus.yml' # 支持热更新 - '--web.enable-lifecycle' - '--web.enable-admin-api' - '--storage.tsdb.path=/prometheus' # 添加告警模块 alertmanager: image: prom/alertmanager:latest container_name: Myalertmanager hostname: alertmanager restart: always ports: - '9093:9093' volumes: - '/data/conf/alertmanager.yml:/etc/alertmanager/alertmanager.yml' - '/data/alertmanager/:/alertmanager/data' command: - '--config.file=/etc/alertmanager/alertmanager.yml' # 添加监控可视化面板 grafana: image: grafana/grafana container_name: grafana hostname: grafana restart: always ports: - '3000:3000' volumes: - '/data/grafana/:/var/lib/grafana' - '/data/grafana/logs/:/var/log/grafana' # 添加客户端监控 exporter: image: prom/node-exporter:latest container_name: node-export ports: - "9100:9100" # 收集容器数据 cadvisor: image: google/cadvisor:v0.24.1 container_name: cadvisor hostname: cadvisor restart: always volumes: - /:/rootfs:ro - /var/run:/var/run:rw - /sys:/sys:ro - /var/lib/docker/:/var/lib/docker:ro ports: - "8080:8080"