stefanprodan / swarmprom

Docker Swarm instrumentation with Prometheus, Grafana, cAdvisor, Node Exporter and Alert Manager
MIT License
1.87k stars 733 forks source link

Docker Swarm Nodes dashboard empty #126

Closed paulmorabito closed 4 years ago

paulmorabito commented 4 years ago

Hi,

I've taken your sample code, changed a little and upgraded to most recent versions so I understand if you can't provide support. I've managed to get everything working really well with the exception of the Docker Swarm Nodes dashboard. No system information is displayed (CPU, RAM etc.) The same goes for the services dashboard (no CPU or RAM info) but all docker and other related info is working fine.

My compose file for node-exporter looks like this:

  node-exporter:
    image: prom/node-exporter:v0.18.1
    networks:
      - net
    environment:
      - NODE_ID={{.Node.ID}}
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
      - /etc/hostname:/etc/nodename
      - node-exporter:/etc/node-exporter
    command:
      - '--path.sysfs=/host/sys'
      - '--path.procfs=/host/proc'
      - '--collector.textfile.directory=/etc/node-exporter/'
      - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
      - '--no-collector.ipvs'
    deploy:
      mode: global
      resources:
        limits:
          memory: 128M
        reservations:
          memory: 64M

I created a volume for /etc/node-exporter as it was throwing an error without it.

When I'm looking at the dashboard in Grafana there is an option for swarm node but the only option is All. So, it looks like the node ID is not being populated.

docker node ls gives the following:

ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
0d664sdtzy1f8akrnfy9f7rqt *   swarm01             Ready               Active              Leader              19.03.8

What I have tried/verified:

Any ideas on how I could fix this would be very appreciated.

paulmorabito commented 4 years ago

Managed to fix this by using the Dockerfile with some modifications to rebuild the image to include the entrypoint shell script.