From 8f98c20c51b4b93cb6f33c9bc385a4c3db242bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=85=89=E6=9D=83?= Date: Fri, 4 Mar 2016 00:09:49 +0800 Subject: [PATCH] Add flags -usage-list to print all plugins inputs for telegraf --- cmd/telegraf/telegraf.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go index a65c5607c..ec8e6315a 100644 --- a/cmd/telegraf/telegraf.go +++ b/cmd/telegraf/telegraf.go @@ -11,7 +11,7 @@ import ( "github.com/influxdata/telegraf/agent" "github.com/influxdata/telegraf/internal/config" - + "github.com/influxdata/telegraf/plugins/inputs" _ "github.com/influxdata/telegraf/plugins/inputs/all" _ "github.com/influxdata/telegraf/plugins/outputs/all" ) @@ -34,6 +34,7 @@ var fOutputFilters = flag.String("output-filter", "", "filter the outputs to enable, separator is :") var fUsage = flag.String("usage", "", "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", "", "filter the inputs to enable, separator is :") @@ -61,6 +62,7 @@ The flags are: -input-filter filter the input 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-list print all the plugins input -debug print metrics as they're generated to stdout -quiet run in quiet mode -version print the version to stdout @@ -135,6 +137,13 @@ func main() { return } + if *fUsageList { + fmt.Println("The plugin inputs avaiable:") + for k, _ := range inputs.Inputs { + fmt.Printf(" %s\n", k) + } + } + var ( c *config.Config err error