Node_exporter: Can't run node_exporter docker on MacOs

Created on 29 Jun 2017  Â·  14Comments  Â·  Source: prometheus/node_exporter

I am using below command to run a node_export docker container on Mac.

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)($|/)"

The container can be run but the port number 9100 is not listenning. Is there anything need to be configured on Mac? As I know, Mac doesn't have /proc directory.

Most helpful comment

Here is the command that worked for me on Docker for Mac:

docker service create --name node \
 --mode global \
 --mount type=bind,source=/proc,target=/host/proc \
 --mount type=bind,source=/sys,target=/host/sys \
 --mount type=bind,source=/,target=/rootfs \
 --network prom \
 prom/node-exporter \
  --path.procfs /host/proc \
  --path.sysfs /host/sys \
  --collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"

prom is a separately created overlay network.

All 14 comments

You should omit --net="host" part. There is also a lot of limitation in Docker for Mac: https://docs.docker.com/docker-for-mac/networking/. It may be simpler to just run exporter binary instead of Docker container.

Running the linux node_exporter binary (which is the one inside our Docker images) on OSX won't give you any interesting metrics. The node_exporter is a low-level exporter tightly coupled to the underlying operating system. In order to use the few collectors we have for darwin/osx you'll need to run the darwin binary.

@grobie A lot of people use Docker for Mac to test configurations and for training purposes. Do you know why this stopped working on Mac?

@vegasbrianc I'm not sure what you mean? There have never been many collectors to export system metrics from darwin. Most of the node_exporter collectors have only been implemented for Linux so far, including all the ones exporting metrics from the /proc filesystem, which isn't available on Mac.

Hi @grobie disregard I used the example from the README and noticed some changes from my current configuration. Everything is working again. Thanks for getting back to me so quickly.

Actually, this is still getting me. But it appears to be a docker compose issue rather than node-exporter. Running the command from the CLI works find. When running from compose it has all sorts of permission denied errors.

Could you post a minimal docker-compose.yml that reproduces the issue? Do
you get the same issue if you use the same on a Linux-Docker node?

On Tue, Oct 10, 2017 at 6:14 AM Brian Christner notifications@github.com
wrote:

Actually, this is still getting me. But it appears to be a docker compose
issue rather than node-exporter. Running the command from the CLI works
find. When running from compose it has all sorts of permission denied
errors.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/prometheus/node_exporter/issues/610#issuecomment-335371558,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAICBt7lVjpkZLA2XXRY0Tpm0cSN13tSks5sqwtggaJpZM4OJQcV
.

Hi @matthiasr Here is the stack - https://github.com/vegasbrianc/prometheus I am currently trying to upgrade with the latest node-exporter flags

@matthiasr @grobie Hi was able to find the issue with this. For Mac and docker-compose, it is required to attach the node-exporter to the host network. I've tried using other networks and it fails it has to be host. However, with Linux machines it doesn't appear to cause issues which network in which it connects.

If you are interested I can open a PR with the sample docker-compose which I use for anyone else wanting to use it in a compose configuration.

I'd rather not add that. We already document the necessary docker run, and that maps pretty directly to compose.
it might be worth noting the original issue though – you can't reasonably run node exporter without --net=host, but for that exposing the exporter port to the host doesn't work. Is there a canonical way to reach the Docker VM?

Here is the command that worked for me on Docker for Mac:

docker service create --name node \
 --mode global \
 --mount type=bind,source=/proc,target=/host/proc \
 --mount type=bind,source=/sys,target=/host/sys \
 --mount type=bind,source=/,target=/rootfs \
 --network prom \
 prom/node-exporter \
  --path.procfs /host/proc \
  --path.sysfs /host/sys \
  --collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"

prom is a separately created overlay network.

@arun-gupta Thanks this has helped a ton!

I think there is nothing to do on our side, so closing this.

@discordianfish Thanks, I somehow missed this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tmegow picture tmegow  Â·  5Comments

Blasterdick picture Blasterdick  Â·  3Comments

prologic picture prologic  Â·  4Comments

belm0 picture belm0  Â·  4Comments

shamimgeek picture shamimgeek  Â·  3Comments