Skip to content

Commit e422cda

Browse files
authored
Merge pull request #1899 from prometheus/superq/install_doc
Update install instructions in README
2 parents 8b46636 + 35f2e3d commit e422cda

File tree

1 file changed

+61
-29
lines changed

1 file changed

+61
-29
lines changed

README.md

Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,64 @@ To expose NVIDIA GPU metrics, [prometheus-dcgm
1414
](https://github.com/NVIDIA/gpu-monitoring-tools#dcgm-exporter)
1515
can be used.
1616

17+
## Installation and Usage
18+
19+
If you are new to Prometheus and `node_exporter` there is a [simple step-by-step guide](https://prometheus.io/docs/guides/node-exporter/).
20+
21+
### Ansible
22+
23+
For automated installs with [Ansible](https://www.ansible.com/), there is the [Cloud Alchemy role](https://github.com/cloudalchemy/ansible-node-exporter).
24+
25+
### RHEL/CentOS/Fedora
26+
27+
There is a [community-supplied COPR repository](https://copr.fedorainfracloud.org/coprs/ibotty/prometheus-exporters/) which closely follows upstream releases.
28+
29+
### Docker
30+
31+
The `node_exporter` is designed to monitor the host system. It's not recommended
32+
to deploy it as a Docker container because it requires access to the host system.
33+
34+
For situations where Docker deployment is needed, some extra flags must be used to allow
35+
the `node_exporter` access to the host namespaces.
36+
37+
Be aware that any non-root mount points you want to monitor will need to be bind-mounted
38+
into the container.
39+
40+
If you start container for host monitoring, specify `path.rootfs` argument.
41+
This argument must match path in bind-mount of host root. The node\_exporter will use
42+
`path.rootfs` as prefix to access host filesystem.
43+
44+
```bash
45+
docker run -d \
46+
--net="host" \
47+
--pid="host" \
48+
-v "/:/host:ro,rslave" \
49+
quay.io/prometheus/node-exporter:latest \
50+
--path.rootfs=/host
51+
```
52+
53+
For Docker compose, similar flag changes are needed.
54+
55+
```yaml
56+
---
57+
version: '3.8'
58+
59+
services:
60+
node_exporter:
61+
image: quay.io/prometheus/node-exporter:latest
62+
container_name: node_exporter
63+
command:
64+
- '--path.rootfs=/host'
65+
network_mode: host
66+
pid: host
67+
restart: unless-stopped
68+
volumes:
69+
- '/:/host:ro,rslave'
70+
```
71+
72+
On some systems, the `timex` collector requires an additional Docker flag,
73+
`--cap-add=SYS_TIME`, in order to access the required syscalls.
74+
1775
## Collectors
1876

1977
There is varying support for collectors on each operating system. The tables
@@ -181,7 +239,7 @@ For advanced use the `node_exporter` can be passed an optional list of collector
181239
182240
This can be useful for having different Prometheus servers collect specific metrics from nodes.
183241
184-
## Building and running
242+
## Development building and running
185243
186244
Prerequisites:
187245
@@ -190,8 +248,8 @@ Prerequisites:
190248
191249
Building:
192250
193-
go get github.com/prometheus/node_exporter
194-
cd ${GOPATH-$HOME/go}/src/github.com/prometheus/node_exporter
251+
git clone https://github.com/prometheus/node_exporter.git
252+
cd node_exporter
195253
make
196254
./node_exporter <flags>
197255
@@ -215,32 +273,6 @@ The exporter supports TLS via a new web configuration file.
215273

216274
See the [https package](https/README.md) for more details.
217275

218-
## Using Docker
219-
The `node_exporter` is designed to monitor the host system. It's not recommended
220-
to deploy it as a Docker container because it requires access to the host system.
221-
Be aware that any non-root mount points you want to monitor will need to be bind-mounted
222-
into the container.
223-
224-
If you start container for host monitoring, specify `path.rootfs` argument.
225-
This argument must match path in bind-mount of host root. The node\_exporter will use
226-
`path.rootfs` as prefix to access host filesystem.
227-
228-
```bash
229-
docker run -d \
230-
--net="host" \
231-
--pid="host" \
232-
-v "/:/host:ro,rslave" \
233-
quay.io/prometheus/node-exporter \
234-
--path.rootfs=/host
235-
```
236-
237-
On some systems, the `timex` collector requires an additional Docker flag,
238-
`--cap-add=SYS_TIME`, in order to access the required syscalls.
239-
240-
## Using a third-party repository for RHEL/CentOS/Fedora
241-
242-
There is a [community-supplied COPR repository](https://copr.fedorainfracloud.org/coprs/ibotty/prometheus-exporters/) which closely follows upstream releases.
243-
244276
[travis]: https://travis-ci.org/prometheus/node_exporter
245277
[hub]: https://hub.docker.com/r/prom/node-exporter/
246278
[circleci]: https://circleci.com/gh/prometheus/node_exporter

0 commit comments

Comments
 (0)