2016-01-26 08:34:09 +08:00
|
|
|
# Example Input Plugin
|
|
|
|
|
|
2020-01-24 07:33:13 +08:00
|
|
|
The `example` plugin gathers metrics about example things. This description
|
2017-04-22 05:25:37 +08:00
|
|
|
explains at a high level what the plugin does and provides links to where
|
|
|
|
|
additional information can be found.
|
2016-01-26 08:34:09 +08:00
|
|
|
|
2022-06-08 05:37:08 +08:00
|
|
|
Telegraf minimum version: Telegraf x.x Plugin minimum tested version: x.x
|
2020-03-11 06:31:59 +08:00
|
|
|
|
2022-10-27 03:58:36 +08:00
|
|
|
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
|
|
|
|
|
|
|
|
|
In addition to the plugin-specific configuration settings, plugins support
|
|
|
|
|
additional global and plugin configuration settings. These settings are used to
|
|
|
|
|
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
|
|
|
|
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
|
|
|
|
|
2023-01-12 23:55:21 +08:00
|
|
|
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
2022-10-27 03:58:36 +08:00
|
|
|
|
2021-11-25 02:56:26 +08:00
|
|
|
## Configuration
|
2016-01-26 08:34:09 +08:00
|
|
|
|
2022-05-24 21:49:47 +08:00
|
|
|
```toml @sample.conf
|
2022-04-12 21:29:02 +08:00
|
|
|
# This is an example plugin
|
2016-01-26 08:34:09 +08:00
|
|
|
[[inputs.example]]
|
2017-09-15 06:50:55 +08:00
|
|
|
example_option = "example_value"
|
2016-01-26 08:34:09 +08:00
|
|
|
```
|
|
|
|
|
|
2022-06-08 05:37:08 +08:00
|
|
|
Running `telegraf --usage <plugin-name>` also gives the sample TOML
|
|
|
|
|
configuration.
|
|
|
|
|
|
2021-11-25 02:56:26 +08:00
|
|
|
### example_option
|
2018-11-15 03:39:48 +08:00
|
|
|
|
2022-06-08 05:37:08 +08:00
|
|
|
A more in depth description of an option can be provided here, but only do so if
|
|
|
|
|
the option cannot be fully described in the sample config.
|
2018-11-15 03:39:48 +08:00
|
|
|
|
2021-11-25 02:56:26 +08:00
|
|
|
## Metrics
|
2016-01-26 08:34:09 +08:00
|
|
|
|
2022-06-08 05:37:08 +08:00
|
|
|
Here you should add an optional description and links to where the user can get
|
|
|
|
|
more information about the measurements.
|
2016-01-26 08:34:09 +08:00
|
|
|
|
2022-06-08 05:37:08 +08:00
|
|
|
If the output is determined dynamically based on the input source, or there are
|
|
|
|
|
more metrics than can reasonably be listed, describe how the input is mapped to
|
|
|
|
|
the output.
|
2017-09-15 06:50:55 +08:00
|
|
|
|
2016-01-26 08:34:09 +08:00
|
|
|
- measurement1
|
2017-09-15 06:50:55 +08:00
|
|
|
- tags:
|
|
|
|
|
- tag1 (optional description)
|
|
|
|
|
- tag2
|
|
|
|
|
- fields:
|
2016-01-26 08:34:09 +08:00
|
|
|
- field1 (type, unit)
|
|
|
|
|
- field2 (float, percent)
|
|
|
|
|
|
2021-11-25 02:56:26 +08:00
|
|
|
- measurement2
|
2017-09-15 06:50:55 +08:00
|
|
|
- tags:
|
2016-01-26 08:34:09 +08:00
|
|
|
- tag3
|
2017-09-15 06:50:55 +08:00
|
|
|
- fields:
|
|
|
|
|
- field3 (integer, bytes)
|
2020-01-24 07:33:13 +08:00
|
|
|
- field4 (integer, green=1 yellow=2 red=3)
|
|
|
|
|
- field5 (string)
|
|
|
|
|
- field6 (float)
|
|
|
|
|
- field7 (boolean)
|
2017-04-04 09:34:04 +08:00
|
|
|
|
2021-11-25 02:56:26 +08:00
|
|
|
## Sample Queries
|
2016-08-09 06:06:03 +08:00
|
|
|
|
2018-11-15 03:39:48 +08:00
|
|
|
This section can contain some useful InfluxDB queries that can be used to get
|
|
|
|
|
started with the plugin or to generate dashboards. For each query listed,
|
2017-04-22 05:25:37 +08:00
|
|
|
describe at a high level what data is returned.
|
2016-08-09 06:06:03 +08:00
|
|
|
|
2017-04-22 05:25:37 +08:00
|
|
|
Get the max, mean, and min for the measurement in the last hour:
|
2021-11-25 02:56:26 +08:00
|
|
|
|
|
|
|
|
```sql
|
2016-08-09 06:06:03 +08:00
|
|
|
SELECT max(field1), mean(field1), min(field1) FROM measurement1 WHERE tag1=bar AND time > now() - 1h GROUP BY tag
|
|
|
|
|
```
|
2016-01-26 08:34:09 +08:00
|
|
|
|
2021-11-25 02:56:26 +08:00
|
|
|
## Troubleshooting
|
2018-11-15 03:39:48 +08:00
|
|
|
|
|
|
|
|
This optional section can provide basic troubleshooting steps that a user can
|
|
|
|
|
perform.
|
|
|
|
|
|
2023-01-10 21:46:17 +08:00
|
|
|
## Example Output
|
2016-01-26 08:34:09 +08:00
|
|
|
|
2017-09-15 06:50:55 +08:00
|
|
|
This section shows example output in Line Protocol format. You can often use
|
|
|
|
|
`telegraf --input-filter <plugin-name> --test` or use the `file` output to get
|
|
|
|
|
this information.
|
|
|
|
|
|
2023-01-10 21:46:17 +08:00
|
|
|
```text
|
2016-01-26 08:34:09 +08:00
|
|
|
measurement1,tag1=foo,tag2=bar field1=1i,field2=2.1 1453831884664956455
|
|
|
|
|
measurement2,tag1=foo,tag2=bar,tag3=baz field3=1i 1453831884664956455
|
|
|
|
|
```
|