Use host PID namespace in docker example (#672)

* Use host PID namespace in docker example

See https://github.com/prometheus/node_exporter/issues/671

* Update readme for readability

* Fix comments in readme
This commit is contained in:
david 2017-11-02 04:07:40 -07:00 committed by Johannes 'fish' Ziemke
parent defe2f373c
commit eb3a917bd8

View file

@ -166,40 +166,16 @@ To see all available configuration flags:
## Using Docker ## Using Docker
The node\_exporter is designed to monitor the host system. It's not recommended 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. 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 Be aware that any non-root mount points you want to monitor will need bind-mounted
[node-exporter Docker into the container.
image](https://quay.io/repository/prometheus/node-exporter) with the following
options and bind-mounts:
for docker version >= 1.10
```bash ```bash
docker run -d -p 9100:9100 \ docker run -d \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro,rslave" \
--net="host" \ --net="host" \
quay.io/prometheus/node-exporter \ --pid="host" \
--path.procfs /host/proc \ quay.io/prometheus/node-exporter
--path.sysfs /host/sys \
--collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
``` ```
for docker version < 1.10
```bash
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 \
--path.procfs /host/proc \
--path.sysfs /host/sys \
--collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
```
Be aware though that the mountpoint label in various metrics will now have
`/rootfs` as prefix.
## Using a third-party repository for RHEL/CentOS/Fedora ## Using a third-party repository for RHEL/CentOS/Fedora
There is a [community-supplied COPR repository](https://copr.fedorainfracloud.org/coprs/ibotty/prometheus-exporters/). It closely follows upstream releases. There is a [community-supplied COPR repository](https://copr.fedorainfracloud.org/coprs/ibotty/prometheus-exporters/). It closely follows upstream releases.