From e5f3c9cefc36a4043d4e0fc065af9a7e3efeb8ff Mon Sep 17 00:00:00 2001 From: noramullen1 <42354779+noramullen1@users.noreply.github.com> Date: Tue, 16 Nov 2021 19:23:19 -0800 Subject: [PATCH] Create Telegraf commands and flags doc (#3382) * Create telegraf commands doc * Add specification examples * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: Scott Anderson * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: Scott Anderson * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: Scott Anderson * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: Scott Anderson * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: Scott Anderson * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: Scott Anderson * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: Scott Anderson * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: Scott Anderson * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Update content/telegraf/v1.20/administration/commands.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Address PR feedback Co-authored-by: Scott Anderson Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> --- .../telegraf/v1.20/administration/commands.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 content/telegraf/v1.20/administration/commands.md diff --git a/content/telegraf/v1.20/administration/commands.md b/content/telegraf/v1.20/administration/commands.md new file mode 100644 index 000000000..796386c47 --- /dev/null +++ b/content/telegraf/v1.20/administration/commands.md @@ -0,0 +1,91 @@ +--- +title: Telegraf commands and flags +description: The `telegraf` command starts and runs all the processes necessary for Telegraf to function. +menu: + telegraf_1_20: + name: Commands + weight: 20 + parent: Administration +--- + +The `telegraf` command starts and runs all the processes necessary for Telegraf to function. + +## Usage + +``` +telegraf [commands] +telegraf [flags] +``` + +## Commands + + + +| Command | Description | +| :-------- | :--------------------------------------------- | +| `config` | Print out full sample configuration to stdout. | +| `version` | Print version to stdout. | + +## Flags + +| Flag | Description | +| :------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- | +| `--aggregator-filter ` | Filter aggregators to enable. Separator is `:`. | +| `--config ` | Configuration file to load. | +| `--config-directory ` | Directory containing additional `*.conf` files. | +| `--watch-config` | Restart Telegraf on local configuration changes. Use either fs notifications (`inotify`) or polling (`poll`). Disabled by default | +| `--plugin-directory ` | Directory containing `*.so` files to search recursively for plugins. Found plugins are loaded, tagged, and identified. | +| `--debug` | Enable debug logging. | +| `--input-filter ` | Filter input plugins to enable. Separator is `:`. | +| `--input-list` | Print available input plugins. | +| `--output-filter` | Filter output plugins to enable. Separator is `:`. | +| `--output-list` | Print available output plugins. | +| `--pidfile ` | File to write PID to. | +| `--pprof-addr
` | pprof address to listen on. Disabled by default. | +| `--processor-filter ` | Filter processor plugins to enable. Separator is `:`. | +| `--quiet` | Run in quiet mode. | +| `--section-filter ` | Filter configuration sections to output (`agent`, `global_tags`, `outputs`, `processors`, `aggregators` and `inputs`). Separator is `:`. | +| `--sample-config` | Print full sample configuration. | +| `--once` | Gather metrics once, write them, and exit. | +| `--test` | Gather metrics once and print them. | +| `--test-wait` | Number of seconds to wait for service inputs to complete in test or once mode. | +| `--usage ` | Print plugin usage (example: `telegraf --usage mysql`). | +| `--version` | Print Telegraf version. | + +## Examples + +### Generate a Telegraf configuration file + +```sh +telegraf config > telegraf.conf +``` + +### Generate configuration with only CPU input and InfluxDB output plugins defined + +```sh +telegraf --input-filter cpu --output-filter influxdb config +``` + +### Run a single Telegraf configuration, outputting metrics to stdout + +```sh +telegraf --config telegraf.conf --test +``` + +### Run Telegraf with all plugins defined in configuration file** + +```sh +telegraf --config telegraf.conf +``` + +### Run Telegraf, enabling the CPU and memory input plugins and InfluxDB output plugin** + +```sh +telegraf --config telegraf.conf --input-filter cpu:mem --output-filter influxdb +``` + +### Run Telegraf with pprof + +```sh +telegraf --config telegraf.conf --pprof-addr localhost:6060 +```