How Telegraf works
Telegraf is a plugin-driven agent. A single Telegraf binary contains hundreds of plugins, and the plugins you enable in your configuration file determine what Telegraf collects, how it transforms that data, and where it writes it.
Plugin types
Four plugin types form the Telegraf data pipeline:
- Input plugins collect metrics from systems, services, databases, and sensors.
- Processor plugins transform, decorate, and filter metrics as they pass through the pipeline.
- Aggregator plugins produce new aggregate metrics, such as running means, minimums, and maximums, over configurable time windows.
- Output plugins write metrics to destinations such as InfluxDB, files, and message queues.
Two more plugin types extend how Telegraf runs:
- Secret store plugins keep credentials out of plain-text configuration files and resolve them at runtime. See secret store plugins.
- External plugins run outside the Telegraf binary, in any language,
through the
execdfamily of plugins. See external plugins.
Every plugin is configured in the same TOML configuration file, and you can enable multiple instances of the same plugin. For the complete list of available plugins, see the Plugin directory.
Polling and service inputs
Most input plugins poll: on each collection interval, Telegraf calls the plugin to gather current values, such as CPU usage or a database query result.
Service input plugins listen instead of polling. They run continuously, receiving data pushed to them from sources such as message queues (Kafka, MQTT, AMQP), socket listeners, and webhooks, and they emit metrics into the pipeline as data arrives.
Parsers and serializers
Many plugins move data in formats other than Telegraf metrics:
- Parsers convert raw input data, such as JSON, CSV, or Prometheus
exposition format, into Telegraf metrics.
Input plugins that support parsing accept a
data_formatoption that selects one of the input data formats. - Serializers convert Telegraf metrics into an output representation,
such as InfluxDB line protocol, JSON, or Graphite.
Output plugins that support serialization accept a
data_formatoption that selects one of the output data formats.
Learn more
Telegraf metrics
Telegraf metrics are the internal representation used to model data during processing. Each metric includes a measurement name, tags, fields, and a timestamp.
The Telegraf data pipeline
Learn how metrics flow through Telegraf: input plugins collect and parse data, processor and aggregator plugins transform it, and output plugins buffer, serialize, and write it to destinations.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Telegraf and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.