Add ipaddress along with hostname tag for metrics in telegraf/system

I would like to add IP address along with hostname for all metrics collected by plugings/inputs/system .

  1. I was unable to find the code that adds hostname tag , where is it done ?
  2. Any suggestions on how to add ipaddress tag ?

The host tag is configured in the agent section of the configuration file, but you probably want to add ipaddress using the global tags. The easiest way is to add it to an environment variable like the $USER example.