telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

Use FQDN hostname

Open ghost opened this issue 10 years ago • 6 comments

Hi,

Currently telegraf's default behaviour is to use 'os.Hostname()' where no hostname tag is specified. I need this value to be an fqdn name as my servers are grouped by dns zones.

Is that possible to add a "use_fqdn = true or false" option in order to keep compatibility with the current behaviour but enabling to use fqdn names for users needing it ?

Thanks.

ghost avatar Sep 23 '16 10:09 ghost

Unfortunately Go doesn't appear to natively support getting the FQDN name, so I'm not sure it's possible to support this feature.

Could you use an environment variable as a tag to workaround this?

sparrc avatar Sep 23 '16 10:09 sparrc

Hooo... really ???

Its a bit annoying, how can I provide an environment variable to the configuration file ? I found nothing on the documentation to provide variables... In my case it would be something like "var = $(hostname -f)"

I'm suprised that the Go language is not able to provide that :-(

ghost avatar Sep 23 '16 12:09 ghost

Nope, they need to be env variables, it doesn't call out to shell: https://github.com/influxdata/telegraf/blob/master/etc/telegraf.conf#L12

sparrc avatar Sep 23 '16 12:09 sparrc

Ok, i solved it by adding an FQDN variable export on the Systemd script and by overriding the 'hostname' tag with the variable. It's not an elegant solution, but it work... Thanks for your answers.

ghost avatar Sep 23 '16 13:09 ghost

OK :+1:

sparrc avatar Sep 23 '16 14:09 sparrc

photobox-dgo --- do we have same thing for windows?

maddygoes avatar Mar 08 '17 17:03 maddygoes