provide args for telegraf for consistency with influxd:
- telegraf version - telegraf config closes #857
This commit is contained in:
parent
faa5033300
commit
a11bd68b68
|
@ -96,8 +96,9 @@ func main() {
|
||||||
reload <- false
|
reload <- false
|
||||||
flag.Usage = func() { usageExit(0) }
|
flag.Usage = func() { usageExit(0) }
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
args := flag.Args()
|
||||||
|
|
||||||
if flag.NFlag() == 0 {
|
if flag.NFlag() == 0 && len(args) == 0 {
|
||||||
usageExit(0)
|
usageExit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +122,18 @@ func main() {
|
||||||
outputFilters = strings.Split(":"+outputFilter+":", ":")
|
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 {
|
if *fOutputList {
|
||||||
fmt.Println("Available Output Plugins:")
|
fmt.Println("Available Output Plugins:")
|
||||||
for k, _ := range outputs.Outputs {
|
for k, _ := range outputs.Outputs {
|
||||||
|
|
Loading…
Reference in New Issue