Omit_hostname with multiple Telegraf config files

Hello,
I created a Docker Swarm cluster lab with three Linux servers as virtual machines. I then deployed Telegraf in the swarm with deploy mode global and InfluxDB with 1 replica. This is only to illustrate the background scenario.
I have two Telegraf config files:

  • main (telegraf.conf): it is used for gathering the swarm nodes performance data (cpu, memory, disk, diskio) by using the default input plugin.
  • secondary (shellies.conf): it collects metrics data from a mqtt broker where some Shelly devices I own publish IOT data.

The main config file has omit_hostname = false in the agent section, this way I can get all performance data of three hosts forming the cluster separately or all together:

So far so good.
The problem is about the shellies bucket:

I am not interested in the Host field, it does matter anything with the Shelly IOT data. Those metrics are not relevant to the cluster nodes and (worse) those data are written three times, one each for every host.

Thank you.

If I understand correctly, you have 3 Telegraf instances, one for each server.

There is just one safe way to avoid the N-uplication of the Shelly IOT data, which is don’t read them multiple times, which means:

  • Make a standalone Telegraf to monitor that
  • Use that config only in one of the hosts

about the omit_hostname, it creates the host tag after processors/aggregators are executed so there is no way of altering it using those… you can hopefully use it as a filter in the output to avoid sending Shelly data from specified hosts (or allow it for just one host), but this is not a nice way to handle the process…
if you collect the data properly this shouldn’t be an issue anymore