$linuxjunkies
>

telegraf(8)

Telegraf is a plugin-driven server agent for collecting and reporting metrics from systems, applications, and services.

UbuntuDebianFedoraArch

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

FlagWhat it does
-configPath to configuration file; if omitted, telegraf looks in standard locations
-config-directoryDirectory containing .conf files to load in addition to main config file
-testRun one collection cycle and print metrics to stdout, then exit; useful for testing config
-sample-configPrint out a sample configuration file to stdout
-sample-config-filterFilter sample config output to specified plugin types (inputs, outputs, etc.)
-input-filterLoad only specified input plugins (comma-separated list)
-output-filterLoad only specified output plugins (comma-separated list)
-pprof-addrEnable Go profiling on specified address (e.g. localhost:6060)
-versionDisplay telegraf version and exit
-quietSuppress informational log messages

Examples

Start telegraf with the standard configuration file

telegraf -config /etc/telegraf/telegraf.conf

Generate a complete sample configuration file with all available plugins

telegraf -sample-config > telegraf.conf

Test the configuration by running one collection cycle and printing output to terminal

telegraf -config telegraf.conf -test

Run telegraf using only CPU, memory, and disk inputs, outputting only to InfluxDB

telegraf -input-filter cpu,mem,disk -output-filter influxdb -config telegraf.conf

Load main config plus all .conf files from the telegraf.d directory

telegraf -config-directory /etc/telegraf/telegraf.d -config /etc/telegraf/telegraf.conf

Show 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

Related commands