version: "3"
services:
  prometheus: 
    image: prom/prometheus:v2.18.1
    ports:
      - "9090:9090"
    volumes:
      - /var/prometheus/etc:/etc/prometheus
      - /var/prometheus/data:/prometheus
    environment:
      - TZ=Asia/Shanghai
    deploy:
      replicas: 1 
      restart_policy:
        condition: on-failure
      placement:
        constraints:
          - node.labels.data-type == nfs
  node-exporter:
    image: prom/node-exporter:v1.0.0
    ports:
      - '9100:9100'
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    command:
      - '--path.rootfs=/rootfs'
      - '--path.procfs=/host/proc' 
      - '--path.sysfs=/host/sys'
      - "--collector.filesystem.ignored-mount-points"
      - "^/(dev|host|etc|rootfs/var/lib/docker)($$|/)"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    deploy:
      mode: global
  grafana: 
    image: grafana/grafana:7.0.0
    environment:
      - TZ=Asia/Shanghai
    ports:
      - "3000:3000"     

-------node-exporter还是不适合用docker运行,对于Ubuntu14.04支持不好,建议升级机器。