Skip to content
Snippets Groups Projects
Commit 8f98c20c authored by 张光权's avatar 张光权 Committed by Cameron Sparr
Browse files

Add flags -usage-list to print all plugins inputs for telegraf

parent 1c76d5d0
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ import ( ...@@ -11,7 +11,7 @@ import (
"github.com/influxdata/telegraf/agent" "github.com/influxdata/telegraf/agent"
"github.com/influxdata/telegraf/internal/config" "github.com/influxdata/telegraf/internal/config"
"github.com/influxdata/telegraf/plugins/inputs"
_ "github.com/influxdata/telegraf/plugins/inputs/all" _ "github.com/influxdata/telegraf/plugins/inputs/all"
_ "github.com/influxdata/telegraf/plugins/outputs/all" _ "github.com/influxdata/telegraf/plugins/outputs/all"
) )
...@@ -34,6 +34,7 @@ var fOutputFilters = flag.String("output-filter", "", ...@@ -34,6 +34,7 @@ var fOutputFilters = flag.String("output-filter", "",
"filter the outputs to enable, separator is :") "filter the outputs to enable, separator is :")
var fUsage = flag.String("usage", "", var fUsage = flag.String("usage", "",
"print usage for a plugin, ie, 'telegraf -usage mysql'") "print usage for a plugin, ie, 'telegraf -usage mysql'")
var fUsageList = flag.Bool("usage-list", false, "print all the plugins inputs")
var fInputFiltersLegacy = flag.String("filter", "", var fInputFiltersLegacy = flag.String("filter", "",
"filter the inputs to enable, separator is :") "filter the inputs to enable, separator is :")
...@@ -61,6 +62,7 @@ The flags are: ...@@ -61,6 +62,7 @@ The flags are:
-input-filter filter the input plugins to enable, separator is : -input-filter filter the input plugins to enable, separator is :
-output-filter filter the output plugins to enable, separator is : -output-filter filter the output plugins to enable, separator is :
-usage print usage for a plugin, ie, 'telegraf -usage mysql' -usage print usage for a plugin, ie, 'telegraf -usage mysql'
-usage-list print all the plugins input
-debug print metrics as they're generated to stdout -debug print metrics as they're generated to stdout
-quiet run in quiet mode -quiet run in quiet mode
-version print the version to stdout -version print the version to stdout
...@@ -135,6 +137,13 @@ func main() { ...@@ -135,6 +137,13 @@ func main() {
return return
} }
if *fUsageList {
fmt.Println("The plugin inputs avaiable:")
for k, _ := range inputs.Inputs {
fmt.Printf(" %s\n", k)
}
}
var ( var (
c *config.Config c *config.Config
err error err error
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment