5
plugins/processors/all/all.go
Normal file
5
plugins/processors/all/all.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package all
|
||||
|
||||
import (
|
||||
_ "github.com/influxdata/telegraf/plugins/processors/printer"
|
||||
)
|
||||
35
plugins/processors/printer/printer.go
Normal file
35
plugins/processors/printer/printer.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package printer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins/processors"
|
||||
)
|
||||
|
||||
type Printer struct {
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
`
|
||||
|
||||
func (p *Printer) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (p *Printer) Description() string {
|
||||
return "Print all metrics that pass through this filter."
|
||||
}
|
||||
|
||||
func (p *Printer) Apply(in ...telegraf.Metric) []telegraf.Metric {
|
||||
for _, metric := range in {
|
||||
fmt.Println(metric.String())
|
||||
}
|
||||
return in
|
||||
}
|
||||
|
||||
func init() {
|
||||
processors.Add("printer", func() telegraf.Processor {
|
||||
return &Printer{}
|
||||
})
|
||||
}
|
||||
0
plugins/processors/printer/printer_test.go
Normal file
0
plugins/processors/printer/printer_test.go
Normal file
11
plugins/processors/registry.go
Normal file
11
plugins/processors/registry.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package processors
|
||||
|
||||
import "github.com/influxdata/telegraf"
|
||||
|
||||
type Creator func() telegraf.Processor
|
||||
|
||||
var Processors = map[string]Creator{}
|
||||
|
||||
func Add(name string, creator Creator) {
|
||||
Processors[name] = creator
|
||||
}
|
||||
Reference in New Issue
Block a user