Update multifile plugin docs

This commit is contained in:
Daniel Nelson 2019-01-23 17:26:50 -08:00
parent 7a031c48cd
commit 35d18d3fd7
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
3 changed files with 24 additions and 13 deletions

View File

@ -5,6 +5,7 @@
- [cloud_pubsub](/plugins/inputs/cloud_pubsub/README.md) - Contributed by @emilymye - [cloud_pubsub](/plugins/inputs/cloud_pubsub/README.md) - Contributed by @emilymye
- [neptune_apex](/plugins/inputs/neptune_apex/README.md) - Contributed by @MaxRenaud - [neptune_apex](/plugins/inputs/neptune_apex/README.md) - Contributed by @MaxRenaud
- [nginx_upstream_check](/plugins/inputs/nginx_upstream_check/README.md) - Contributed by @dmitryilyin - [nginx_upstream_check](/plugins/inputs/nginx_upstream_check/README.md) - Contributed by @dmitryilyin
- [multifile](/plugins/inputs/multifile/README.md) - Contributed by @martin2250
#### New Outputs #### New Outputs

View File

@ -206,6 +206,7 @@ For documentation on the latest development code see the [documentation index][d
* [minecraft](./plugins/inputs/minecraft) * [minecraft](./plugins/inputs/minecraft)
* [mongodb](./plugins/inputs/mongodb) * [mongodb](./plugins/inputs/mongodb)
* [mqtt_consumer](./plugins/inputs/mqtt_consumer) * [mqtt_consumer](./plugins/inputs/mqtt_consumer)
* [multifile](./plugins/inputs/multifile)
* [mysql](./plugins/inputs/mysql) * [mysql](./plugins/inputs/mysql)
* [nats_consumer](./plugins/inputs/nats_consumer) * [nats_consumer](./plugins/inputs/nats_consumer)
* [nats](./plugins/inputs/nats) * [nats](./plugins/inputs/nats)

View File

@ -1,16 +1,20 @@
# Multifile Input Plugin # Multifile Input Plugin
### Description The multifile input plugin allows Telegraf to combine data from multiple files
The multifile input plugin allows telegraf to gather data from multiple files into a single point, creating one field or tag per file. 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 ### Configuration
``` ```toml
[[inputs.multifile]] [[inputs.multifile]]
## Base directory where telegraf will look for files. ## Base directory where telegraf will look for files.
## Omit this option to use absolute paths. ## Omit this option to use absolute paths.
base_dir = "/sys/bus/i2c/devices/1-0076/iio:device0" 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. ## Else, Telegraf omits the field generated from this file.
# fail_early = true # fail_early = true
@ -28,18 +32,20 @@ The multifile input plugin allows telegraf to gather data from multiple files in
dest = "humidityrelative" dest = "humidityrelative"
conversion = "float(3)" conversion = "float(3)"
``` ```
* `file.file`:
Path of the file to be parsed Each file table can contain the following options:
* `file.dest`: * `file`:
Name of the field/tag created, defaults to `$(basename file)` Path of the file to be parsed, relative to the `base_dir`.
* `file.conversion`: * `dest`:
Data format used to parse the file contents 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(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)`. * `float`: Converts the value into a float with no adjustment. Same as `float(0)`.
* `int`: Convertes the value into an integer. * `int`: Convertes the value into an integer.
* `string`, `""`: No conversion * `string`, `""`: No conversion.
* `bool`: Convertes the value into a boolean * `bool`: Convertes the value into a boolean.
* `tag`: File content is used as a tag * `tag`: File content is used as a tag.
### Example Output ### Example Output
This example shows a BME280 connected to a Raspberry Pi, using the sample config. This example shows a BME280 connected to a Raspberry Pi, using the sample config.
@ -57,3 +63,6 @@ The kernel driver provides the following files in `/sys/bus/i2c/devices/1-0076/i
* `in_humidityrelative_input`: `48900` * `in_humidityrelative_input`: `48900`
* `in_pressure_input`: `101.343285156` * `in_pressure_input`: `101.343285156`
* `in_temp_input`: `20400` * `in_temp_input`: `20400`
[input data formats]: /docs/DATA_FORMATS_INPUT.md
[file]: /plugins/inputs/file/README.md