Skip to content

Commit

Permalink
Update multifile plugin docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson committed Jan 24, 2019
1 parent 7a031c4 commit 35d18d3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [cloud_pubsub](/plugins/inputs/cloud_pubsub/README.md) - Contributed by @emilymye
- [neptune_apex](/plugins/inputs/neptune_apex/README.md) - Contributed by @MaxRenaud
- [nginx_upstream_check](/plugins/inputs/nginx_upstream_check/README.md) - Contributed by @dmitryilyin
- [multifile](/plugins/inputs/multifile/README.md) - Contributed by @martin2250

#### New Outputs

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ For documentation on the latest development code see the [documentation index][d
* [minecraft](./plugins/inputs/minecraft)
* [mongodb](./plugins/inputs/mongodb)
* [mqtt_consumer](./plugins/inputs/mqtt_consumer)
* [multifile](./plugins/inputs/multifile)
* [mysql](./plugins/inputs/mysql)
* [nats_consumer](./plugins/inputs/nats_consumer)
* [nats](./plugins/inputs/nats)
Expand Down
35 changes: 22 additions & 13 deletions plugins/inputs/multifile/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Multifile Input Plugin

### Description
The multifile input plugin allows telegraf to gather data from multiple files into a single point, creating one field or tag per file.
The multifile input plugin allows Telegraf to combine data from multiple files
into a single metric, creating one field or tag per file. This is often
useful creating custom metrics from the `/sys` or `/proc` filesystems.

> Note: If you wish to parse metrics from a single file formatted in one of the supported
> [input data formats][], you should use the [file][] input plugin instead.
### Configuration
```
```toml
[[inputs.multifile]]
## Base directory where telegraf will look for files.
## Omit this option to use absolute paths.
base_dir = "/sys/bus/i2c/devices/1-0076/iio:device0"

## If true, Telegraf discard all data when a single file can't be read.
## If true discard all data when a single file can't be read.
## Else, Telegraf omits the field generated from this file.
# fail_early = true

Expand All @@ -28,18 +32,20 @@ The multifile input plugin allows telegraf to gather data from multiple files in
dest = "humidityrelative"
conversion = "float(3)"
```
* `file.file`:
Path of the file to be parsed
* `file.dest`:
Name of the field/tag created, defaults to `$(basename file)`
* `file.conversion`:
Data format used to parse the file contents

Each file table can contain the following options:
* `file`:
Path of the file to be parsed, relative to the `base_dir`.
* `dest`:
Name of the field/tag key, defaults to `$(basename file)`.
* `conversion`:
Data format used to parse the file contents:
* `float(X)`: Converts the input value into a float and divides by the Xth power of 10. Efficively just moves the decimal left X places. For example a value of `123` with `float(2)` will result in `1.23`.
* `float`: Converts the value into a float with no adjustment. Same as `float(0)`.
* `int`: Convertes the value into an integer.
* `string`, `""`: No conversion
* `bool`: Convertes the value into a boolean
* `tag`: File content is used as a tag
* `string`, `""`: No conversion.
* `bool`: Convertes the value into a boolean.
* `tag`: File content is used as a tag.

### Example Output
This example shows a BME280 connected to a Raspberry Pi, using the sample config.
Expand All @@ -57,3 +63,6 @@ The kernel driver provides the following files in `/sys/bus/i2c/devices/1-0076/i
* `in_humidityrelative_input`: `48900`
* `in_pressure_input`: `101.343285156`
* `in_temp_input`: `20400`

[input data formats]: /docs/DATA_FORMATS_INPUT.md
[file]: /plugins/inputs/file/README.md

0 comments on commit 35d18d3

Please sign in to comment.