Multiple inputs.http

#1

Hi

I need to collect data, via the inputs.http plugin, from multiple ip addresses, each running the same response code. I’ve added the following to the telegraf inputs.http section but I’m not sure about the host tag.

[[inputs.http]]
   urls = [
	"http://ms-00001:8085/mediationproxy/api/appDetailsTelegraf"    
   ]
   method = "GET"
   timeout = "5s"
   tagexclude = ["url"]     

  [inputs.http.tags]
    host="ms-00001"

[[inputs.http]]
   urls = [
	"http://ms-00002:8085/mediationproxy/api/appDetailsTelegraf"    
   ]
   method = "GET"
   timeout = "5s"
   tagexclude = ["url"]
   
  [inputs.http.tags]
    host="ms-00002"

The data I collect seems to populate a column of “host_1” rather than “host”. Is there any reason for this? Everything else is working fine and as long as I know that the column is “host_1”, that’s fine also.
Just wondering whether I’ve done something wrong or assuming something?

TIA
Martin

#2

Any chance you are collecting a host field as well? If you have both a tag and a field with the same name one will be displayed with _1 appended to the column name when you query it from InfluxDB.

#3

Thanks Daniel but no. However, I’ve dropped the measurement completely and then recreated it from my http response and voila, everything was as expected. I must admit my understanding of tags is still a little hazy :flushed:, and the use of single quote vs double quotes, so it may be possible that a field rather than a tag had incorrectly been created initially and the ‘drop’ had sorted it all out.

Thanks though. :+1: