您好,我想知道是否有人准备好为 Influxdb 添加一个插件到 Telegraf。我有正在运行的 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{} …Run Code Online (Sandbox Code Playgroud)