Documentation

Telegraf commands and flags

The telegraf command starts and runs all the processes necessary for Telegraf to function.

Usage

telegraf [commands]
telegraf [flags]
  • Copy
  • Fill window

Commands

CommandDescription
configGenerate and migrate Telegraf configurations
secretsManage secrets in secret stores
pluginsPrint available plugins
versionPrint current version to stdout

Global flags

FlagDescription
--config <file>Configuration file to load.
--config-directory <directory>Directory containing additional *.conf files.
--test-waitNumber of seconds to wait for service inputs to complete in test or once mode.
--usage <plugin>Print plugin usage (example: telegraf --usage mysql).
--pprof-addr <address>pprof address to listen on. Disabled by default.
--watch-configRestart Telegraf on local configuration changes. Use either fs notifications (notify) or polling (poll). Disabled by default.
--pidfile <file>File to write PID to.
--password <password>Password to unlock secret stores.
--old-env-behaviorSwitch back to pre-v1.27 environment replacement behavior.
--onceGather metrics once, write them, and exit.
--debugEnable debug logging.
--quietRun in quiet mode.
--unprotectedDo not protect secrets in memory.
--testGather metrics once and print them.
--deprecation-listPrint all deprecated plugins or plugin options.
--input-listPrint available input plugins.
--output-listPrint available output plugins.
--version(Deprecated) Print Telegraf version.
--sample-config(Deprecated) Print full sample configuration.
--plugin-directory <directory>(Deprecated) Directory containing *.so files to search recursively for plugins. Found plugins are loaded, tagged, and identified.
--section-filter <filter>Filter configuration sections to output (agent, global_tags, outputs, processors, aggregators and inputs). Separator is :.
--input-filter <filter>Filter input plugins to enable. Separator is :.
--output-filterFilter output plugins to enable. Separator is :.
--aggregator-filter <filter>Filter aggregators to enable. Separator is :.
--processor-filter <filter>Filter processor plugins to enable. Separator is :.
--secretstore-filter <filter>Filter secretstore plugins to enable. Separator is :.

Examples

Generate a Telegraf configuration file

telegraf config > telegraf.conf
  • Copy
  • Fill window

Generate a configuration with only specific plugins

telegraf config \
  --input-filter cpu \
  --output-filter influxdb
  • Copy
  • Fill window

Run a single Telegraf configuration and output metrics to stdout

telegraf --config telegraf.conf --test
  • Copy
  • Fill window

Run Telegraf with all plugins defined in configuration file

telegraf --config telegraf.conf
  • Copy
  • Fill window

Run Telegraf, but only enable specific plugins

telegraf \
  --config telegraf.conf \
  --input-filter cpu:mem \
  --output-filter influxdb
  • Copy
  • Fill window

Run Telegraf with pprof

telegraf \
  --config telegraf.conf \
  --pprof-addr localhost:6060
  • Copy
  • Fill window

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB 3 Core and Enterprise are now in Beta

InfluxDB 3 Core and Enterprise are now available for beta testing, available under MIT or Apache 2 license.

InfluxDB 3 Core is a high-speed, recent-data engine that collects and processes data in real-time, while persisting it to local disk or object storage. InfluxDB 3 Enterprise is a commercial product that builds on Core’s foundation, adding high availability, read replicas, enhanced security, and data compaction for faster queries. A free tier of InfluxDB 3 Enterprise will also be available for at-home, non-commercial use for hobbyists to get the full historical time series database set of capabilities.

For more information, check out: