2017-10-11 03:02:01 +08:00
# BasicStats Aggregator Plugin
2022-06-07 07:04:28 +08:00
The BasicStats aggregator plugin give us count, diff, max, min, mean,
non_negative_diff, sum, s2(variance), stdev for a set of values, emitting the
aggregate every `period` seconds.
2017-10-11 03:02:01 +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:45:12 +08:00
## Configuration
2017-10-11 03:02:01 +08:00
2022-05-26 00:25:51 +08:00
```toml @sample .conf
2017-10-11 03:02:01 +08:00
# Keep the aggregate basicstats of each metric passing through.
[[aggregators.basicstats]]
## The period on which to flush & clear the aggregator.
period = "30s"
2019-09-24 06:39:50 +08:00
2017-10-11 03:02:01 +08:00
## If true, the original metric will be dropped by the
## aggregator and will not get sent to the output plugins.
drop_original = false
2017-12-15 08:56:10 +08:00
## Configures which basic stats to push as fields
2020-11-21 04:53:51 +08:00
# stats = ["count","diff","rate","min","max","mean","non_negative_diff","non_negative_rate","stdev","s2","sum","interval"]
2017-10-11 03:02:01 +08:00
```
2017-12-15 08:56:10 +08:00
- stats
2021-11-25 02:45:12 +08:00
- If not specified, then `count` , `min` , `max` , `mean` , `stdev` , and `s2` are aggregated and pushed as fields. `sum` , `diff` and `non_negative_diff` are not aggregated by default to maintain backwards compatibility.
- If empty array, no stats are aggregated
2017-12-15 08:56:10 +08:00
2021-11-25 02:45:12 +08:00
## Measurements & Fields
2017-10-11 03:02:01 +08:00
- measurement1
2021-11-25 02:45:12 +08:00
- field1_count
- field1_diff (difference)
- field1_rate (rate per second)
- field1_max
- field1_min
- field1_mean
- field1_non_negative_diff (non-negative difference)
- field1_non_negative_rate (non-negative rate per second)
- field1_sum
- field1_s2 (variance)
- field1_stdev (standard deviation)
- field1_interval (interval in nanoseconds)
## Tags
2017-10-11 03:02:01 +08:00
No tags are applied by this aggregator.
2021-11-25 02:45:12 +08:00
## Example Output
2017-10-11 03:02:01 +08:00
2021-11-25 02:45:12 +08:00
```shell
2017-10-11 03:02:01 +08:00
$ telegraf --config telegraf.conf --quiet
system,host=tars load1=1 1475583980000000000
system,host=tars load1=1 1475583990000000000
2020-11-21 04:53:51 +08:00
system,host=tars load1_count=2,load1_diff=0,load1_rate=0,load1_max=1,load1_min=1,load1_mean=1,load1_sum=2,load1_s2=0,load1_stdev=0,load1_interval=10000000000i 1475584010000000000
2017-10-11 03:02:01 +08:00
system,host=tars load1=1 1475584020000000000
system,host=tars load1=3 1475584030000000000
2020-11-21 04:53:51 +08:00
system,host=tars load1_count=2,load1_diff=2,load1_rate=0.2,load1_max=3,load1_min=1,load1_mean=2,load1_sum=4,load1_s2=2,load1_stdev=1.414162,load1_interval=10000000000i 1475584010000000000
2017-10-11 03:02:01 +08:00
```