1

我想要一个完整的 grafana,包含所有可能用于 docker 和这些容器的图形。

这是我的问题:

如您所见,我的图形是空的。 https://i.ibb.co/kJD8hf1/1.png

这是我的图表“容器 CPU 使用率”: 在此处输入图像描述

如果我删除“图像!=''”,我有这个: 在此处输入图像描述

我认为我的 cadvisor 和我的 docker 守护进程配置有问题

/etc/docker/daemon.js

{
  "tls": true,
  "tlscacert":"/root/docker_ssl/ca.pem",
  "tlscert": "/root/docker_ssl/server-cert.pem",
  "tlskey": "/root/docker_ssl/server-key.pem",
  "tlsverify":true,
  "hosts": [
        "tcp://0.0.0.0:2376",
        "unix:///var/run/docker.sock"
  ],
  "icc": false,
  "userns-remap": "default",
  "live-restore": true,
  "no-new-privileges": true
}

码头工人撰写:

version: '2.4'

volumes:
    prometheus_data: {}
    grafana_data: {}


services:
  prometheus:
    image: prom/prometheus:v2.1.0
    cpus: '2'
    mem_limit: 512M
    volumes:
      - /opt/container_data/monitoring/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'
    links:
      - cadvisor:cadvisor
      - alertmanager:alertmanager
    depends_on:
      - cadvisor
    networks:
      - backend
    restart: always

  node-exporter:
    image: prom/node-exporter
    cpus: '2'
    mem_limit: 512M
    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)($$|/)"
    networks:
      - backend
    restart: always


  alertmanager:
    image: prom/alertmanager
    cpus: '2'
    mem_limit: 512M
    volumes:
      - /opt/container_data/monitoring/alertmanager/:/etc/alertmanager/
    networks:
      - backend
    restart: always
    command:
      - '--config.file=/etc/alertmanager/config.yml'
      - '--storage.path=/alertmanager'

  cadvisor:
    image: google/cadvisor
    cpus: '2'
    mem_limit: 512M
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /dev/disk/:/dev/disk:ro
      - /cgroup:/cgroup:ro
      - /var/lib/docker/:/var/lib/docker:ro
    networks:
      - backend
    restart: always

  grafana:
    image: grafana/grafana
    cpus: '2'
    mem_limit: 512M
    user: "104"
    depends_on:
      - prometheus
    volumes:
      - grafana_data:/var/lib/grafana
      - /opt/container_data/monitoring/grafana/provisioning/:/etc/grafana/provisioning/
    env_file:
      - /opt/container_data/monitoring/grafana/config.monitoring
    networks:
      - backend
      - frontend
    restart: always

networks:
  frontend:
    external:
      name: frontend
  backend:
    driver: bridge
    external: false

我使用了这个存储库https://github.com/vegasbrianc/prometheus 所以最终结果应该是这个 https://grafana.com/grafana/dashboards/179在此处输入图像描述

谢谢。

4

0 回答 0