Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run node_exporter docker on MacOs #610

Closed
zhaoyi0113 opened this issue Jun 29, 2017 · 19 comments
Closed

Can't run node_exporter docker on MacOs #610

zhaoyi0113 opened this issue Jun 29, 2017 · 19 comments

Comments

@zhaoyi0113
Copy link

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.

@AlekSi
Copy link
Contributor

AlekSi commented Jul 5, 2017

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.

@grobie
Copy link
Member

grobie commented Jul 5, 2017

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.

@vegasbrianc
Copy link

@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?

@grobie
Copy link
Member

grobie commented Oct 9, 2017

@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.

@vegasbrianc
Copy link

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.

@vegasbrianc
Copy link

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.

@matthiasr
Copy link
Contributor

matthiasr commented Oct 10, 2017 via email

@vegasbrianc
Copy link

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

@vegasbrianc
Copy link

@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.

@matthiasr
Copy link
Contributor

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?

@arun-gupta
Copy link

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.

@vegasbrianc
Copy link

@arun-gupta Thanks this has helped a ton!

@discordianfish
Copy link
Member

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

@vegasbrianc
Copy link

@discordianfish Thanks, I somehow missed this.

@willin
Copy link

willin commented Feb 4, 2021

@arun-gupta

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

Error: No such network: prom

@matthiasr
Copy link
Contributor

prom is a separately created overlay network.

I think that means you will need some form of docker network create prom.

@Hongten
Copy link

Hongten commented Mar 17, 2021

prom is a separately created overlay network.

I think that means you will need some form of docker network create prom.

Env: Mac High Sierra 10.13.4
I use docker network create prom to create a network prom
I can see if when I query network docker network ls. But I still encountered Error: No such network: prom

@Hongten
Copy link

Hongten commented Mar 17, 2021

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.

Hello @arun-gupta , Can you help to advise? thanks a lot.

@discordianfish
Copy link
Member

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.

@prometheus prometheus locked as resolved and limited conversation to collaborators Mar 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants