Is there a simple way to get current IP adress of the host and assign it as a global tag using telegraf for both windows and linux platforms?
This is generally not as easy as it sounds. For example, which IP address are you after? IPv4? IPv6? What if there are multiple on one interface? What interface should use you? The hostname is already added to metrics by default, which tends to be a safer alternative.
What I have seen some users do is use a global tag that uses an environment variable. And then it is up to the user to set that environment variable to the value of the IP address that they care about. Something like:
[global_tags]
ip = "$TELEGRAF_IP_ADDRESS"
And then set that environment variable to the value you want.