telegraf(8)
Telegraf is a plugin-driven server agent for collecting and reporting metrics from systems, applications, and services.
Synopsis
telegraf [OPTIONS] [config file]Description
Telegraf is a lightweight agent written in Go that collects metrics from a wide variety of inputs (system stats, databases, APIs, cloud platforms) and outputs them to multiple backends (InfluxDB, Prometheus, Kafka, HTTP endpoints). It uses a simple TOML configuration format and loads plugins dynamically based on your configuration file.
Run telegraf with a configuration file to start collecting and forwarding metrics. The agent runs as a daemon process and periodically gathers data according to configured intervals and plugin settings.
Common options
| Flag | What it does |
|---|---|
-config | Path to configuration file; if omitted, telegraf looks in standard locations |
-config-directory | Directory containing .conf files to load in addition to main config file |
-test | Run one collection cycle and print metrics to stdout, then exit; useful for testing config |
-sample-config | Print out a sample configuration file to stdout |
-sample-config-filter | Filter sample config output to specified plugin types (inputs, outputs, etc.) |
-input-filter | Load only specified input plugins (comma-separated list) |
-output-filter | Load only specified output plugins (comma-separated list) |
-pprof-addr | Enable Go profiling on specified address (e.g. localhost:6060) |
-version | Display telegraf version and exit |
-quiet | Suppress informational log messages |
Examples
Start telegraf with the standard configuration file
telegraf -config /etc/telegraf/telegraf.confGenerate a complete sample configuration file with all available plugins
telegraf -sample-config > telegraf.confTest the configuration by running one collection cycle and printing output to terminal
telegraf -config telegraf.conf -testRun telegraf using only CPU, memory, and disk inputs, outputting only to InfluxDB
telegraf -input-filter cpu,mem,disk -output-filter influxdb -config telegraf.confLoad main config plus all .conf files from the telegraf.d directory
telegraf -config-directory /etc/telegraf/telegraf.d -config /etc/telegraf/telegraf.confShow sample configuration for input plugins only and view CPU plugin settings
telegraf -sample-config-filter inputs | grep -A5 "\[inputs.cpu\]"Display the installed version of telegraf
telegraf -version