diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go index d54aaa4e3..436d1a38e 100644 --- a/cmd/telegraf/telegraf.go +++ b/cmd/telegraf/telegraf.go @@ -96,8 +96,9 @@ func main() { reload <- false flag.Usage = func() { usageExit(0) } flag.Parse() + args := flag.Args() - if flag.NFlag() == 0 { + if flag.NFlag() == 0 && len(args) == 0 { usageExit(0) } @@ -121,6 +122,18 @@ func main() { outputFilters = strings.Split(":"+outputFilter+":", ":") } + if len(args) > 0 { + switch args[0] { + case "version": + v := fmt.Sprintf("Telegraf - Version %s", Version) + fmt.Println(v) + return + case "config": + config.PrintSampleConfig(inputFilters, outputFilters) + return + } + } + if *fOutputList { fmt.Println("Available Output Plugins:") for k, _ := range outputs.Outputs {