Incorrect hostname picked up by Telegraf (docker container)

The solution to this problem is to create the service using template parameters. You can specify the hostname of the container but using one of the ready to use variables, so the compose file would look something like this:

telegraf:
    image: telegraf:1.21 # not the latest
    hostname: "{{.Node.Hostname}}"

In case it helps someone :slight_smile:

2 Likes