Hello I would to know if someone have all ready add a plugin to telegraf for Influxdb. I have my go code which is working. What do I need next and where to put theses files?
I've found that I need to do something like this:
type ReadFile struct {
//buf []byte
//MemoryBytes int64
//PID int
}
func (s *ReadFile) Description() string {
return "This is a test plugin to read data from a file and send them to influxdb" }
func (s *ReadFile) SampleConfig() string {
return "ok = true # indicate if everything is fine"
}
func Gather(acc plugins.Accumulator) error {
readFile(alarmFile)
acc.Add("alarm", result_of_readFile_here, tags)
}
}
func init() {
plugins.Add("readFile", func() plugins.Plugin { &ReadFile{} })
}
But is this my entire Go plugin or another file in Go to add with my Go program?
And where does the file.conf is store?
[tags]
dc = "alarm"
[agent]
interval = "10s"
# OUTPUTS
[outputs]
[outputs.influxdb]
url = "http://127.0.0.1:8086" # required.
database = "summer" # required.
precision = "s"
# PLUGINS
[readFile]
If you have a list of what I need, how to structure it, where I store file or maybe an example could be really helpful.
Thanks!!