I am using Telegraf to collect docker and system metrics (so far). It is deployed on a swarm on Google Cloud.
If I use the official plugins I don’t have the right hostname (as in a GCE swarm). On my custom plugins, I simply launch a request to http://metadata.google.internal/computeMetadata/v1/instance/name (go code):
req, err := http.NewRequest("GET", "http://metadata.google.internal/computeMetadata/v1/instance/name", nil)
if err != nil {
return "", err
}
req.Header.Set("Metadata-Flavor", "Google")
It works but I wish to use the official plugins (docker and system at least) as much as possible.
It seems that rewriting the hostname could be a task done by a Processor (as presented in Aggregator and Processor Plugins | InfluxData Documentation Archive).
But I can’t find any example of processors that could help me create my own.
So I have 3 questions :
1- can a processor solve my problem, ie rewrite the hostname tag (which is added by telegraf if I am not mistaken)
2- can a processor be a program (in my case in go) ?
3- is there such an example (in any language) and where ?