-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Override IP address in http_response #7598
Description
Feature Request
Proposal:
Add a config setting to the http_response input plugin to override the IP address, to use instead of the resolved hostname. Alternatively, add a way to override the hostname when giving an IP address to urls.
Current behavior:
If I set urls=["http://somehostname/"], telegraf will resolve that hostname in DNS and connect to that IP address. If there are multiple IP addresses, I guess it connects to an arbitrary one. I can't work around it with urls=["http://192.0.2.42/"] and overriding inputs.http_response.headers.Host, because then it would fail to verify SSL. Even with insecure_skip_verify it would fail because it wouldn't send the correct hostname in SNI.
Desired behavior:
A new config setting lets me change the IP address the plugin connects to, so I can use the hostname in the URL but connect to another IP.
Alternatively, a new config setting lets me change the hostname used in the Host: header, the SSL SNI, and the SSL certificate verification, so I can use the IP address in the URL but everything else still behaves as if the URL had the hostname.
In either case, both the hostname and the IP address should be somewhere in the resulting tags, so that requests to same hostname but different IP, or viceversa, can be distinguished later.
Use case:
A hostname may point to multiple IP addresses corresponding to different servers. Or it may have both IPv4 and IPv6. Or it may use geodns to return a single IP out of multiple depending on the source's location, and a telegraf instance would always get the same one.
I want to send a request to all IP addresses individually, and collect the response_time for each, so I can know if there is a failure or increased latency for only one server, or for only IPv6.