Using a docker container that has InfluxDB, Telegraf, and Grafana.
What I want to do: in my InfluxDB dashboard, use the Variable menu to select a different host and show the stats for that host.
The cells of the dashboards use v.host as a variable, so they should show that host’s data.
The Variables in Influxdb are defined as CSV: “myserver1”, “myserver2”, “myserver3”.
The telegraf.conf file has in the [[agent]] section a default host of “myserver1”.
What actually happens: dashboard shows data fine for “myserver1”, but as soon as I choose “myserver2” or “myserver3”, no data is displayed.
How do I obtain my objective?
@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
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.
That was clear.
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
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.