forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update commands and flags page (influxdata#12162)
- Loading branch information
Showing
1 changed file
with
37 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,57 @@ | ||
# Telegraf Commands & Flags | ||
|
||
## Usage | ||
The following page describes some of the commands and flags available via the | ||
Telegraf command line interface. | ||
|
||
```shell | ||
telegraf [commands] | ||
telegraf [flags] | ||
``` | ||
## Usage | ||
|
||
## Commands | ||
General usage of Telegraf, requires passing in at least one config file with | ||
the plugins the user wishes to use: | ||
|
||
|command|description| | ||
|--------|-----------------------------------------------| | ||
|`config` |print out full sample configuration to stdout| | ||
|`version`|print the version to stdout| | ||
```bash | ||
telegraf --config config.toml | ||
``` | ||
|
||
## Flags | ||
## Help | ||
|
||
|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. Monitor changes using either fs notifications or polling. Valid values: `inotify` or `poll`. 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| | ||
|`--deprecation-list` |print all deprecated plugins or plugin options| | ||
|`--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 `:`. 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. **No outputs are executed!**| | ||
|`--test-wait` |wait up to this many seconds for service inputs to complete in test or once mode. **Implies `--test` if not used with `--once`**| | ||
|`--usage <plugin>` |print usage for a plugin, ie, `telegraf --usage mysql`| | ||
|`--version` |display the version and exit| | ||
To get the full list of subcommands and flags run: | ||
|
||
## Examples | ||
```bash | ||
telegraf help | ||
``` | ||
|
||
**Generate a telegraf config file:** | ||
Here are some commonly used flags that users should be aware of: | ||
|
||
`telegraf config > telegraf.conf` | ||
* `--config-directory`: Read all config files from a directory | ||
* `--debug`: Enable additional debug logging | ||
* `--once`: Run one collection and flush interval then exit | ||
* `--test`: Run only inputs, output to stdout, and exit | ||
|
||
**Generate config with only cpu input & influxdb output plugins defined:** | ||
Check out the full help out for more available flags and options. | ||
|
||
`telegraf config --input-filter cpu --output-filter influxdb` | ||
## Version | ||
|
||
**Run a single telegraf collection, outputting metrics to stdout:** | ||
While telegraf will print out the version when running, if a user is uncertain | ||
what version their binary is, run the version subcommand: | ||
|
||
`telegraf --config telegraf.conf --test` | ||
```bash | ||
telegraf version | ||
``` | ||
|
||
**Run telegraf with all plugins defined in config file:** | ||
## Config | ||
|
||
`telegraf --config telegraf.conf` | ||
The config subcommand allows users to print out a sample configuration to | ||
stdout. This subcommand can very quickly print out the default values for all | ||
or any of the plugins available in Telegraf. | ||
|
||
**Run telegraf, enabling the cpu & memory input, and influxdb output plugins:** | ||
For example to print the example config for all plugins run: | ||
|
||
`telegraf --config telegraf.conf --input-filter cpu:mem --output-filter influxdb` | ||
```bash | ||
telegraf config > telegraf.conf | ||
``` | ||
|
||
**Run telegraf with pprof:** | ||
If a user only wanted certain inputs or outputs, then the filters can be used: | ||
|
||
`telegraf --config telegraf.conf --pprof-addr localhost:6060` | ||
```bash | ||
telegraf config --input-filter cpu --output-filter influxdb | ||
``` |