2016-11-04 22:12:22 +08:00
# Telegraf Aggregator & Processor Plugins
As of release 1.1.0, Telegraf has the concept of Aggregator and Processor Plugins.
These plugins sit in-between Input & Output plugins, aggregating and processing
metrics as they pass through Telegraf:
2021-11-25 02:45:19 +08:00
```text
2016-11-04 22:12:22 +08:00
┌───────────┐
│ │
│ CPU │───┐
│ │ │
└───────────┘ │
│
┌───────────┐ │ ┌───────────┐
│ │ │ │ │
│ Memory │───┤ ┌──▶│ InfluxDB │
│ │ │ │ │ │
└───────────┘ │ ┌─────────────┐ ┌─────────────┐ │ └───────────┘
2020-12-11 02:21:58 +08:00
│ │ │ │Aggregators │ │
┌───────────┐ │ │Processors │ │ - mean │ │ ┌───────────┐
2016-11-04 22:12:22 +08:00
│ │ │ │ - transform │ │ - quantiles │ │ │ │
│ MySQL │───┼───▶│ - decorate │────▶│ - min/max │───┼──▶│ File │
│ │ │ │ - filter │ │ - count │ │ │ │
└───────────┘ │ │ │ │ │ │ └───────────┘
│ └─────────────┘ └─────────────┘ │
┌───────────┐ │ │ ┌───────────┐
│ │ │ │ │ │
│ SNMP │───┤ └──▶│ Kafka │
│ │ │ │ │
└───────────┘ │ └───────────┘
│
┌───────────┐ │
│ │ │
│ Docker │───┘
│ │
└───────────┘
```
Both Aggregators and Processors analyze metrics as they pass through Telegraf.
2017-10-31 07:32:39 +08:00
Use [measurement filtering ](CONFIGURATION.md#measurement-filtering )
to control which metrics are passed through a processor or aggregator. If a
metric is filtered out the metric bypasses the plugin and is passed downstream
to the next plugin.
2021-11-25 02:45:19 +08:00
## Processor
2019-01-30 14:01:17 +08:00
Processor plugins process metrics as they pass through and immediately emit
2016-11-04 22:12:22 +08:00
results based on the values they process. For example, this could be printing
all metrics or adding a tag to all metrics that pass through.
2021-11-25 02:45:19 +08:00
## Aggregator
2019-01-30 14:01:17 +08:00
Aggregator plugins, on the other hand, are a bit more complicated. Aggregators
2016-11-04 22:12:22 +08:00
are typically for emitting new _aggregate_ metrics, such as a running mean,
2020-02-04 10:13:00 +08:00
minimum, maximum, or standard deviation. For this reason, all _aggregator_
2016-11-04 22:12:22 +08:00
plugins are configured with a `period` . The `period` is the size of the window
of metrics that each _aggregate_ represents. In other words, the emitted
_aggregate_ metric will be the aggregated value of the past `period` seconds.
Since many users will only care about their aggregates and not every single metric
gathered, there is also a `drop_original` argument, which tells Telegraf to only
emit the aggregates and not the original metrics.
2019-01-30 14:01:17 +08:00
Since aggregates are created for each measurement, field, and unique tag combination
the plugin receives, you can make use of `taginclude` to group
2020-12-11 02:21:58 +08:00
aggregates by specific tags only.
2019-01-30 14:01:17 +08:00
2020-05-30 06:32:46 +08:00
**Note:** Aggregator plugins only aggregate metrics within their periods (`now() - period`). Data with a timestamp earlier than `now() - period` cannot be included.