Skip to content

Commit 6d22c27

Browse files
authored
Merge pull request #1216 from influxdata/master
Expanded telegraf documentation for docker specific use cases
2 parents d826fd0 + 4700610 commit 6d22c27

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

telegraf/content.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,39 @@ Check that the measurement `foo` is added in the DB.
171171
- [Input Plugins](https://docs.influxdata.com/telegraf/latest/plugins/inputs/)
172172

173173
- [Output Plugins](https://docs.influxdata.com/telegraf/latest/plugins/outputs/)
174+
175+
### Monitoring the host filesystem
176+
177+
One of the more common use cases for Telegraf is running it in a container to monitor the host filesystem using the inputs that take information from the `/proc` filesystem. This section only applies to monitoring a Linux host.
178+
179+
To do this, you can mount the host's `/proc` filesystem inside of the container and set the location of `/proc` to an alternate location by using the `HOST_PROC` environment variable to change the location of where `/proc` is located. As an example:
180+
181+
```console
182+
$ docker run -d --name=telegraf \
183+
--net=influxdb \
184+
-e HOST_PROC=/host/proc \
185+
-v /proc:/host/proc:ro \
186+
-v $PWD/telegraf.conf:/etc/telegraf/telegraf.conf:ro \
187+
%%IMAGE%%
188+
```
189+
190+
### Monitoring docker containers
191+
192+
To monitor other docker containers, you can use the docker plugin and mount the docker socket into the container. An example configuration is below:
193+
194+
```toml
195+
[[inputs.docker]]
196+
endpoint = "unix:///var/run/docker.sock"
197+
```
198+
199+
Then you can start the telegraf container.
200+
201+
```console
202+
$ docker run -d --name=telegraf \
203+
--net=influxdb \
204+
-v /var/run/docker.sock:/var/run/docker.sock \
205+
-v $PWD/telegraf.conf:/etc/telegraf/telegraf.conf:ro \
206+
%%IMAGE%%
207+
```
208+
209+
Refer to the docker [plugin documentation](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/docker/README.md) for more information.

0 commit comments

Comments
 (0)