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
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](https://quay.io/repository/prometheus/node-exporter) with the following
options and bind-mounts:
Be aware that any non-root mount points you want to monitor will need bind-mounted
into the container.
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,rslave" \
docker run -d \
--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)($|/)"
--pid="host" \
quay.io/prometheus/node-exporter
```
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
There is a [community-supplied COPR repository](https://copr.fedorainfracloud.org/coprs/ibotty/prometheus-exporters/). It closely follows upstream releases.