Print webhook plugin after service plugin.
This commit is contained in:
parent
0380ea2e70
commit
9e8dfcae17
|
@ -246,6 +246,13 @@ var serviceInputHeader = `
|
||||||
###############################################################################
|
###############################################################################
|
||||||
`
|
`
|
||||||
|
|
||||||
|
var webhookInputHeader = `
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# WEBHOOK INPUT PLUGINS #
|
||||||
|
###############################################################################
|
||||||
|
`
|
||||||
|
|
||||||
// PrintSampleConfig prints the sample config
|
// PrintSampleConfig prints the sample config
|
||||||
func PrintSampleConfig(inputFilters []string, outputFilters []string) {
|
func PrintSampleConfig(inputFilters []string, outputFilters []string) {
|
||||||
fmt.Printf(header)
|
fmt.Printf(header)
|
||||||
|
@ -292,11 +299,16 @@ func printFilteredInputs(inputFilters []string, commented bool) {
|
||||||
}
|
}
|
||||||
sort.Strings(pnames)
|
sort.Strings(pnames)
|
||||||
|
|
||||||
// cache service inputs to print them at the end
|
// cache service inputs to print them after inputs
|
||||||
servInputs := make(map[string]telegraf.ServiceInput)
|
servInputs := make(map[string]telegraf.Input)
|
||||||
// for alphabetical looping:
|
// for alphabetical looping:
|
||||||
servInputNames := []string{}
|
servInputNames := []string{}
|
||||||
|
|
||||||
|
// cache service inputs to print them after at the end
|
||||||
|
webhookInputs := make(map[string]telegraf.Input)
|
||||||
|
// for alphabetical looping:
|
||||||
|
webhookInputNames := []string{}
|
||||||
|
|
||||||
// Print Inputs
|
// Print Inputs
|
||||||
for _, pname := range pnames {
|
for _, pname := range pnames {
|
||||||
creator := inputs.Inputs[pname]
|
creator := inputs.Inputs[pname]
|
||||||
|
@ -307,19 +319,31 @@ func printFilteredInputs(inputFilters []string, commented bool) {
|
||||||
servInputs[pname] = p
|
servInputs[pname] = p
|
||||||
servInputNames = append(servInputNames, pname)
|
servInputNames = append(servInputNames, pname)
|
||||||
continue
|
continue
|
||||||
|
case telegraf.WebhookInput:
|
||||||
|
webhookInputs[pname] = p
|
||||||
|
webhookInputNames = append(webhookInputNames, pname)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
printConfig(pname, input, "inputs", commented)
|
printConfig(pname, input, "inputs", commented)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print Service Inputs
|
// Print service input
|
||||||
if len(servInputs) == 0 {
|
printOtherInputs(serviceInputHeader, servInputs, servInputNames, commented)
|
||||||
|
|
||||||
|
// Print webhook input
|
||||||
|
printOtherInputs(webhookInputHeader, webhookInputs, webhookInputNames, commented)
|
||||||
|
}
|
||||||
|
|
||||||
|
func printOtherInputs(header string, inputs map[string]telegraf.Input, names []string, commented bool) {
|
||||||
|
if len(names) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sort.Strings(servInputNames)
|
|
||||||
fmt.Printf(serviceInputHeader)
|
sort.Strings(names)
|
||||||
for _, name := range servInputNames {
|
fmt.Printf(header)
|
||||||
printConfig(name, servInputs[name], "inputs", commented)
|
for _, name := range names {
|
||||||
|
printConfig(name, inputs[name], "inputs", commented)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue