@Guy_Levin The default hostname written by Telegraf is the value returned by os.Hostname(). If you set the hostname config under [[agent]] in your Telegraf config, it overrides the default hostname (see the [[agent]] config docs). So if you’re using the same telegraf.conf on multiple machines, your current setting makes it so they all have the host=myserver1.
I’d do one of the following:
Leave the [[agent]].hostname config empty so it’s automatically set by the OS.
Create a telegraf.conf for each host with a unique hostname.
I’d suggest the former, but you may need to update the hostname of each host to get the specific hostnames you’re looking for.
Correct me if I’m wrong, but I think my understanding of the telegraf.conf usage was flawed.
Right now, I just have one instance of Telegraf running on my local computer (from a Docker container), pulling the metrics from myserver1.
It sounds like it is expected to have Telegraf running on each host to be monitored. But what if I am restricted from installing Telegraf on the remote servers? If I understand correctly, it sounds like one instance of Telegraf isn’t meant to pull metrics from multiple servers. If that is the case, this idea of having a “hostname” menu wouldn’t work.
@Guy_Levin It depends on which Telegraf input plugins you’re using. If you’re using the basic system plugins (cpu, mem, disk, etc), as far as I know, those only collect metrics from the current host. But other input plugins, like the prometheus plugin, can scrape metrics from a remote endpoint.