Hi,
I posted this as a support issue on telegraf’s github issues page but they redirected me to this Community Blog for support questions.
Link to the issue - Unable to add a new Aggregator Plugin to the telegraf build · Issue #8879 · influxdata/telegraf (github.com)
To give context,
I am working on a customized version of telegraf to be used only for my purposes, For this I created a modified version of basicstats aggregator plugin, following the documentation at their github repo
However I can’t seem to add the absolute or relative path to my plugin file in the plugins/aggregators/all/all.go file. It shows an error saying -
plugins/aggregators/all/all.go:5:2: package plugins/aggregators/mdmratmetrics is not in GOROOT (/usr/local/go/src/plugins/aggregators/mdmratmetrics)
For context, I am creating the new plugin directory at the same directory structure as existing telegraf aggregator plugins.
and if I add it to the all.go in the same format as the existing aggregator plugin paths -
“github.com/influxdata/telegraf/plugins/aggregators/mdmratmetrics”
Then it ignores that file and doesn’t build it along with the binary. When I run the telegraf binary with my config it says -
2021-02-19T00:44:48Z E! [telegraf] Error running agent: Error parsing telegraf.d/network.conf, Undefined but requested aggregator: mdmratmetrics
Am I missing a step for linking/registering the plugin? I can confirm that I am calling the aggregators.Add in the init function as well. I am simply cloning the telegraf source code from a forked repo and running “make” to build telegraf and not through go get to clone the code, I did do the
go get github.com/influxdata/telegraf
during my debug to see if that helps with the build but that command exited instantly without any error
How do I provide the path to my local .go file containing the code for this custom aggregator plugin to be build within telegraf binary? Any help is appreciated! Thanks.