Hello, I would like to know if anyone has any ready to add a plugin to telegraf for Influxdb . I have a go go code that works. What do I need next and where to put my abstract files?
I 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 it my whole Go plugin or another file in Go to add with my Go program?
And where is the file.conf file stored?
[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 the file, or maybe an example can be really useful.
Thanks!!
source share