Node Exporter, is it fine to run it inside a container?

4,751 views
Skip to first unread message

Paulo Gabriel Poiati

unread,
Jul 7, 2017, 11:15:47 AM7/7/17
to Prometheus Users
I'm getting really confused about this...


"The node_exporter is designed to monitor the host system. It's not recommended to deploy it as Docker container because it requires access to the host system. If you need to run it on Docker, you can deploy this exporter using the node-exporter Docker image with the following options and bind-mounts"

docker run -d -p 9100:9100 \
  -v "/proc:/host/proc:ro" \
  -v "/sys:/host/sys:ro" \
  -v "/:/rootfs:ro" \
  --net="host" \
  quay.io/prometheus/node-exporter \
    -collector.procfs /host/proc \
    -collector.sysfs /host/sys \
    -collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"


And from the repo https://github.com/stefanprodan/dockprom we have this (docker-compose.yml):

nodeexporter:
image: prom/node-exporter
container_name: nodeexporter
restart: unless-stopped
expose:
- 9100
networks:
- monitor-net
labels:
org.label-schema.group: "monitoring"

Isn't this supposed to be a reference to node-exporter / Prometheus deploy? Why this isn't following the strict rules from node-exporter repo? Is safe to do this? I mean, will it work like the installation in the host itself? How this is not mounting the volumes and linking the /proc and /sys and still working?

Thanks in advance.

Matthias Rampke

unread,
Jul 8, 2017, 6:46:03 AM7/8/17
to Paulo Gabriel Poiati, Prometheus Users
https://github.com/stefanprodan/dockprom is not associated with the project, I never heard of it before.

The README is correct, there are a lot of issues running node exporter inside a container, because right now it does not know how to break out of it to get a view of the host. So you will end up seeing network stats for the container network, disk stats for the overlay and volumes instead of the actual disks and so on. The options from the README work around some of that but it's not ideal. If you can, run node exporter without a container.

/MR


--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/d36a7403-1ce4-42eb-8d0e-b0517647215b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages