prometheus + grafana 安装

version: '2'
networks:
  monitor:   
    driver: bridge

services:
  prometheus: 
    image: prom/prometheus
    container_name: prometheus        
    hostname: prometheus
    restart: always        
    volumes:
      - /opt/application/moniter/prometheus/config/prometheus.yml:/etc/prometheus/prometheus.yml  - /opt/application/moniter/prometheus/config/node_down.yml:/etc/prometheus/node_down.yml
    ports:            
      - 9090:9090
    networks:            
      - monitor
    
    # alertmanager:
    #    image: prom/alertmanager    
    #    container_name: alertmanager
    #    hostname: alertmanager    
    #    restart: always
    #    volumes:    
    #        - /opt/application/moniter/alertmanager/config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
    #    ports:    
    #        - 8093:9093
    #    networks:
    #        - monitor

    grafana:
      image: grafana/grafana
      container_name: grafana
      hostname: grafana
      restart: always
      volumes:
        - /opt/application/moniter/grafana/log:/var/log/grafana
      ports:
        - 3000:3000
      networks:
        - monitor

    # node-exporter:
    #    image: quay.io/prometheus/node-exporter
    #    container_name: node-exporter
    #   hostname: node-exporter

        # privileged&user参数要加上,否则会抛出device or resource busy报错,当内核<=3.10时,file system泄露
    #    privileged: true
    #    user: root
    #    restart: always
    #    ports:
    #        - 9100:9100
    #    networks:
    #        - monitor

    cadvisor:
      image: google/cadvisor:latest
      container_name: cadvisor
      hostname: cadvisor

      # privileged&user参数要加上,否则会抛出device or resource busy报错,当内核<=3.10时,file system泄露
      restart: always
      privileged: true
      user: root
      volumes:
        - /:/rootfs:ro
        - /var/run:/var/run:rw
        - /sys:/sys:ro
        - /var/lib/docker/:/var/lib/docker:ro
      ports:
        - 9080:8080
      networks:
        - monitor
herui

一枚干着DevOps工作的职业命理师

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据