# Telegraf — Plugin-Driven Server Agent for Collecting Metrics > Telegraf is an open-source agent by InfluxData for collecting, processing, and writing metrics and events from systems, databases, containers, and IoT sensors to any output destination. ## Install Save in your project root: # Telegraf — Plugin-Driven Server Agent for Collecting Metrics ## Quick Use ```bash # Install on Ubuntu sudo apt-get install telegraf # Generate a default config telegraf config > telegraf.conf # Run with a specific config telegraf --config telegraf.conf # Test an input plugin telegraf --input-filter cpu --test ``` ## Introduction Telegraf is a single-binary agent written in Go that collects metrics from over 300 input plugins, applies transformations via processor and aggregator plugins, and ships results to any of its 40+ output plugins. It is the default data collector in the InfluxData TICK stack. ## What Telegraf Does - Collects system metrics (CPU, memory, disk, network) at configurable intervals - Pulls data from databases, message queues, APIs, and cloud services - Applies inline processing: filtering, tagging, renaming, math transformations - Writes to InfluxDB, Prometheus, Kafka, Elasticsearch, and many more outputs - Supports Exec, SNMP, StatsD, and OpenTelemetry input protocols ## Architecture Overview Telegraf is a single Go binary with a plugin-driven architecture. On each configured interval, input plugins gather metrics into an internal buffer. Processor plugins transform individual metrics, aggregator plugins compute windowed statistics, and output plugins flush batches to destinations. All plugins run concurrently with independent goroutines and configurable buffer sizes. ## Self-Hosting & Configuration - Configuration is a single TOML file (`/etc/telegraf/telegraf.conf`) - Use `telegraf --input-filter cpu:mem --output-filter influxdb_v2 config` to scaffold - Drop additional plugin configs in `/etc/telegraf/telegraf.d/` for modular management - Set `interval`, `flush_interval`, and `metric_buffer_limit` to tune throughput - Deploy as a sidecar container or DaemonSet in Kubernetes ## Key Features - 300+ input plugins covering systems, databases, cloud APIs, and IoT protocols - StatsD and OpenTelemetry receivers for application-level metrics - Built-in aggregators: basicstats, histogram, final, merge for windowed computation - Secret store integration (Vault, OS keyring) for credentials in config files - Minimal resource footprint: typically 30-60 MB RAM for common workloads ## Comparison with Similar Tools - **Prometheus Node Exporter** — pull-based exporter; Telegraf pushes and supports many outputs - **Grafana Alloy** — OpenTelemetry-native collector; Telegraf has broader legacy plugin coverage - **Datadog Agent** — SaaS-locked; Telegraf is vendor-neutral and fully open source - **collectd** — C-based collector; Telegraf offers easier TOML config and richer plugin ecosystem ## FAQ **Q: Can Telegraf send data to Prometheus?** A: Yes. The `prometheus_client` output exposes a `/metrics` endpoint that Prometheus scrapes, or use `http` output to remote-write. **Q: How do I monitor Telegraf itself?** A: Enable the `internal` input plugin. It reports Telegraf's own gather errors, buffer usage, and write throughput. **Q: Does Telegraf support Windows?** A: Yes. Official Windows builds are available, with plugins for Windows Performance Counters and Event Log. **Q: Can I run multiple instances on one host?** A: Yes. Run separate instances with different config files and service names for isolated collection pipelines. ## Sources - https://github.com/influxdata/telegraf - https://docs.influxdata.com/telegraf/ --- Source: https://tokrepo.com/en/workflows/b4ca8879-3f30-11f1-9bc6-00163e2b0d79 Author: AI Open Source