Telegraf configuration examples
Use complete, working Telegraf configurations for common scenarios. Each example includes the full configuration file, a walkthrough of each section, and sample output.
Monitor system metrics
Use Telegraf to collect CPU, memory, disk, and network metrics from a host and write them to InfluxDB 3.
Monitor Docker containers
Use Telegraf to collect container CPU, memory, network, and state metrics from the Docker daemon and write them to InfluxDB 3.
Collect JSON data from an HTTP API
Use the Telegraf HTTP input plugin and the json_v2 parser to collect live JSON data from a REST API, using New York City’s Citi Bike station data as the example.
Parse CSV files from a directory
Use the Telegraf directory_monitor input plugin and the CSV parser to ingest CSV files dropped into a directory and write the data to InfluxDB 3.
Parse log files
Use the Telegraf tail input plugin and grok patterns to parse web server access logs into structured metrics and write them to InfluxDB 3.
Collect metrics from Kafka
Use the Telegraf kafka_consumer input plugin to consume JSON messages from Kafka topics, parse them into metrics, and write them to InfluxDB 3 with delivery tracking.
Collect data from MQTT
Use the Telegraf mqtt_consumer input plugin to subscribe to MQTT topics, extract tags from topic paths, parse payloads, and write the data to InfluxDB 3.
Collect industrial data from OPC UA
Use the Telegraf opcua input plugin to read values from an OPC UA server, such as a PLC or SCADA gateway, and write them to InfluxDB 3. Covers browse-based node discovery (Telegraf 1.39+) and explicit node configuration.
Monitor SNMP devices
Use the Telegraf snmp input plugin to poll network devices for system and interface metrics and write them to InfluxDB 3.
Scrape Prometheus endpoints
Use the Telegraf prometheus input plugin to scrape Prometheus metrics endpoints and write the metrics to InfluxDB 3.
Downsample metrics before writing
Use Telegraf aggregator plugins to write raw metrics to one InfluxDB 3 database and five-minute statistical summaries to another.
Route metrics to different outputs
Use Telegraf metric filtering to send different metrics from one pipeline to different InfluxDB 3 databases and other 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.