你好,我想知道是否有人准备 add a plugin to telegraf for Influxdb . 我的go代码正在运行 . 接下来我需要什么以及放置这些文件的位置?
我发现我需要做这样的事情:
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{} })
}
但这是我的整个Go插件还是Go中的另一个文件添加我的Go程序?
file.conf存储在哪里?
[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]
如果你有一个我需要的列表,如何构建它,我存储文件的位置或者一个例子可能真的很有帮助 .
谢谢!!
2 回答
external plugin support已经打开了一个问题,可能是Telegraf 1.4.0的一部分 . 如果可能会加载external *.so files .
在此之前,所有插件都应该合并到主repository via PRs中 . 已经有很多插件在审核过程中等待 . 这个模型显然不是很可扩展 .