prometheus / node_exporter

Exporter for machine metrics
https://prometheus.io/
Apache License 2.0
10.97k stars 2.33k forks source link

No network stats reported when run with docker-compose #1697

Closed GeorgeGedox closed 4 years ago

GeorgeGedox commented 4 years ago

Host operating system: CentOS 7

node_exporter version: 0.18.1

node_exporter command line flags

--path.procfs=/host/proc --path.rootfs=/rootfs --path.sysfs=/host/sys --collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)

Are you running node_exporter in Docker?

Yes, via docker-compose with other agents

What did you do that produced an error?

Inspected the network stats via grafana

What did you expect to see?

Correct network reports like this https://i.imgur.com/5lg2FPM.png

What did you see instead?

An empty network report https://i.imgur.com/ggMX5HW.png

More details

I'm running a basic stack of monitoring agents on the servers that we have, just cadvisor and node exporter for now, this is how the node_exporter service is set up:

nodeexporter:
    image: prom/node-exporter:v0.18.1
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    command:
      - '--path.procfs=/host/proc'
      - '--path.rootfs=/rootfs'
      - '--path.sysfs=/host/sys'
      - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
    restart: unless-stopped

I'm trying to monitor a server that has lots of traffic on it, talking of thousands of visitors that's putting php-fpm on it's knees so we're trying to streamline the network monitoring a bit, thing is that I don't know why it's broken in my stack and it works when ran directly attached to the network via docker run with --net="host"

discordianfish commented 4 years ago

That's by design, use --net="host".

For further questions: It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided.