Last active
          February 1, 2019 03:22 
        
      - 
      
- 
        Save chanjarster/21fb7707246a7970eb89a116ea61f205 to your computer and use it in GitHub Desktop. 
    Docker prometheus stack
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | version: '3.7' | |
| # 基于 https://github.com/vegasbrianc/prometheus/ 修改 | |
| # Prometheus:http://<任意swarm node ip>:9000 | |
| # Node-exporter:http://<任意swarm node ip>:9010 | |
| # Alertmanager:http://<任意swarm node ip>:9020 | |
| # cAdvisor:http://<任意swarm node ip>:9030 | |
| # Grafana:http://<任意swarm node ip>:9040,用户名admin,密码foobar | |
| x-logging: | |
| &default-logging | |
| driver: fluentd | |
| options: | |
| fluentd-address: <fluentdhost>:24224 | |
| fluentd-async-connect: 'true' | |
| mode: non-blocking | |
| max-buffer-size: 4m | |
| tag: "{{.Name}}" | |
| volumes: | |
| prometheus_data: {} | |
| grafana_data: {} | |
| alertmanager_data: {} | |
| networks: | |
| monitor-net: | |
| external: true | |
| services: | |
| prometheus: | |
| image: prom/prometheus:v2.6.1 | |
| volumes: | |
| - ./prometheus/:/etc/prometheus/ | |
| - prometheus_data:/prometheus | |
| command: | |
| - '--config.file=/etc/prometheus/prometheus.yml' | |
| - '--storage.tsdb.path=/prometheus' | |
| - '--web.console.libraries=/usr/share/prometheus/console_libraries' | |
| - '--web.console.templates=/usr/share/prometheus/consoles' | |
| ports: | |
| - 9000:9090 | |
| networks: | |
| - monitor-net | |
| deploy: | |
| restart_policy: | |
| condition: on-failure | |
| placement: | |
| constraints: | |
| - node.labels.for-monitor-stack == 1 | |
| logging: *default-logging | |
| node-exporter: | |
| image: prom/node-exporter | |
| 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)($$|/)" | |
| ports: | |
| - 9010:9100 | |
| networks: | |
| - monitor-net | |
| deploy: | |
| restart_policy: | |
| condition: on-failure | |
| mode: global | |
| logging: *default-logging | |
| alertmanager: | |
| image: prom/alertmanager:v0.16.0 | |
| ports: | |
| - 9020:9093 | |
| volumes: | |
| - "./alertmanager/:/etc/alertmanager/" | |
| - alertmanager_data:/etc/alertmanager/data | |
| networks: | |
| - monitor-net | |
| restart: always | |
| command: | |
| - '--config.file=/etc/alertmanager/config.yml' | |
| - '--storage.path=/alertmanager' | |
| deploy: | |
| placement: | |
| constraints: | |
| - node.labels.for-monitor-stack == 1 | |
| logging: *default-logging | |
| cadvisor: | |
| image: google/cadvisor:v0.32.0 | |
| volumes: | |
| - /:/rootfs:ro | |
| - /var/run:/var/run:ro | |
| - /sys:/sys:ro | |
| - /var/lib/docker/:/var/lib/docker:ro | |
| - /dev/disk/:/dev/disk:ro | |
| command: | |
| - '--enable_load_reader=true' | |
| ports: | |
| - 9030:8080 | |
| networks: | |
| - monitor-net | |
| deploy: | |
| restart_policy: | |
| condition: on-failure | |
| mode: global | |
| logging: *default-logging | |
| grafana: | |
| image: grafana/grafana:5.4.3 | |
| ports: | |
| - 9040:3000 | |
| volumes: | |
| - grafana_data:/var/lib/grafana | |
| - ./grafana/provisioning/:/etc/grafana/provisioning/ | |
| env_file: | |
| - ./grafana/config.monitoring | |
| networks: | |
| - monitor-net | |
| deploy: | |
| restart_policy: | |
| condition: on-failure | |
| placement: | |
| constraints: | |
| - node.labels.for-monitor-stack == 1 | |
| logging: *default-logging | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment