Skip to content

Commit

Permalink
docs: document telegraf commands and flags (influxdata#9635)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjwang90 authored Sep 20, 2021
1 parent 38cb624 commit 9ecf604
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docs/COMMANDS_AND_FLAGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Telegraf Commands & Flags

### Usage

```
telegraf [commands]
telegraf [flags]
```

### Commands

|command|description|
|--------|-----------------------------------------------|
|`config` |print out full sample configuration to stdout|
|`version`|print the version to stdout|

### Flags

|flag|description|
|-------------------|------------|
|`--aggregator-filter <filter>` |filter the aggregators to enable, separator is `:`|
|`--config <file>` |configuration file to load|
|`--config-directory <directory>` |directory containing additional *.conf files|
|`--watch-config` |Telegraf will restart on local config changes. <br> Monitor changes using either fs notifications or polling. Valid values: `inotify` or `poll`.<br> Monitoring is off by default.|
|`--plugin-directory` |directory containing *.so files, this directory will be searched recursively. Any Plugin found will be loaded and namespaced.|
|`--debug` |turn on debug logging|
|`--input-filter <filter>` |filter the inputs to enable, separator is `:`|
|`--input-list` |print available input plugins.|
|`--output-filter <filter>` |filter the outputs to enable, separator is `:`|
|`--output-list` |print available output plugins.|
|`--pidfile <file>` |file to write our pid to|
|`--pprof-addr <address>` |pprof address to listen on, don't activate pprof if empty|
|`--processor-filter <filter>` |filter the processors to enable, separator is `:`|
|`--quiet` |run in quiet mode|
|`--section-filter` |filter config sections to output, separator is `:` <br> Valid values are `agent`, `global_tags`, `outputs`, `processors`, `aggregators` and `inputs`|
|`--sample-config` |print out full sample configuration|
|`--once` |enable once mode: gather metrics once, write them, and exit|
|`--test` |enable test mode: gather metrics once and print them|
|`--test-wait` |wait up to this many seconds for service inputs to complete in test or once mode|
|`--usage <plugin>` |print usage for a plugin, ie, `telegraf --usage mysql`|
|`--version` |display the version and exit|

### Examples

**Generate a telegraf config file:**

`telegraf config > telegraf.conf`

**Generate config with only cpu input & influxdb output plugins defined:**

`telegraf --input-filter cpu --output-filter influxdb config`

**Run a single telegraf collection, outputting metrics to stdout:**

`telegraf --config telegraf.conf --test`

**Run telegraf with all plugins defined in config file:**

`telegraf --config telegraf.conf`

**Run telegraf, enabling the cpu & memory input, and influxdb output plugins:**

`telegraf --config telegraf.conf --input-filter cpu:mem --output-filter influxdb`

**Run telegraf with pprof:**

`telegraf --config telegraf.conf --pprof-addr localhost:6060`
3 changes: 3 additions & 0 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ To generate a file with specific inputs and outputs, you can use the
telegraf --input-filter cpu:mem:net:swap --output-filter influxdb:kafka config
```

[View the full list][flags] of Telegraf commands and flags or by running `telegraf --help`.

### Configuration Loading

The location of the configuration file can be set via the `--config` command
Expand Down Expand Up @@ -671,3 +673,4 @@ Reference the detailed [TLS][] documentation.
[telegraf.conf]: /etc/telegraf.conf
[TLS]: /docs/TLS.md
[glob pattern]: https://github.com/gobwas/glob#syntax
[flags]: /docs/COMMANDS_AND_FLAGS.md

0 comments on commit 9ecf604

Please sign in to comment.